r/cpp • • Mar 18 '26

What open source projects in C++ have the highest code quality?

My understanding of the characteristics of quality code are the conventional ones.

  • operations on an object that are allowed in a particular object state do not put the object into an invalid state.
  • it's prioritized to organize the implementation of each object into the smallest possible number of sub-objects.
  • no cryptically abbreviated names are used, except possible in very small scopes.

    With the program(s)/executable(s) themselves, as well as modules with corresponding namespaces, being considered singleton objects.

Fair dinkum if you want to name projects that score well under a different understanding of code quality.

193 Upvotes

100 comments sorted by

View all comments

Show parent comment

20

u/OlivierTwist Mar 18 '26

c++20 isn't less portable than c++17

Sweet summer child...

We have customers on RedHat-8.8. Our binaries should work with glibc-2.28 and headers be complilable by gcc-8.4.

-1

u/emidln Mar 18 '26

I compile with c++2c (26) and target hosts with Linux 3.x and 4.x kernels and unknown libcs. Ship the dependencies you use. Statically compile or RPATH with $ORIGIN and ship your installer to patch .interp to your ld.so if you need dynamic libraries for some reason. Relying on a random host's binary libraries to be magically compatible is delusional and should be mocked.

1

u/OlivierTwist Mar 18 '26

We have C++ in headers.

-11

u/Serious-Regular Mar 18 '26 edited Mar 18 '26

Do you people have literally any idea what you're talking about? This has literally zero to do with portability 🤦🤦🤦

Edit: Portability means it works across architectures not across time (backwards compatible with ancient versions of the compiler) because that's fucking impossible

13

u/yuri-kilochek Mar 18 '26

Rather, it seems you have an oddly narrow and specific definition of portability which doesn't include the software stack under your program.

5

u/38thTimesACharm Mar 18 '26

Not OP but to me, portability and compatibility are different things. I would say needing to support old versions is a compatibility problem, while a portability problem would be relying on GNU extensions or assuming UTF-8.

2

u/yuri-kilochek Mar 18 '26 edited Mar 18 '26

How is a GNU extension different from a new standard feature? Both limit where you can build your code, and both can be resolved by either modifying the code to not use them or getting a compiler that supports them.

4

u/Serious-Regular Mar 18 '26 edited Mar 18 '26

Both limit where you can build your code

Portable code means it compiles for multiple targets not that it compiles on multiple targets. Like lemme ask you: do you think people doing embedded dev are compiling on the microcontrollers themselves.............?

2

u/Serious-Regular Mar 18 '26

Portability means it works across architectures not across time (backwards compatible with ancient versions of the compiler) because that's fucking impossible

-9

u/MarcoGreek Mar 18 '26

There are so many different ways to ship your binaries in a container like Flatpak, docker, podman, toolbox etc..

8

u/OlivierTwist Mar 18 '26

My message contains enough information to understand that all what you have mentioned is absolutely irrelevant.

-1

u/MarcoGreek Mar 18 '26

We had a similar problem and Flatpak solved it in our case. Is you program only depending on glibc? So it is not C++?

7

u/yuri-kilochek Mar 18 '26

He's shipping compiled dynamic libraries with headers, containers are irrelevant.

-3

u/MarcoGreek Mar 18 '26

But then he can make a LTS version for customers who don't want to move to a new platform.

5

u/OlivierTwist Mar 18 '26

You didn't have a similar problem, because Flatpak is irrelevant for shared libraries and headers.

Please check what glibc is.

3

u/MarcoGreek Mar 18 '26

I mean our solution was Flatpak. We shipped binaries before and had all that symbol problems.

2

u/OlivierTwist Mar 18 '26

How does Flatpak help if your dynamic library should be used by another dynamic library?

1

u/MarcoGreek Mar 18 '26

So no application is using your dynamic library?

2

u/OlivierTwist Mar 18 '26

Library is used by app or lib, doesn't matter. What matters is that library users are bound to some old gcc for whatever reason.

2

u/MarcoGreek Mar 18 '26

Yes, but that leads other potential customers to avoid that library. It is a trade-off.

→ More replies

2

u/pjmlp Mar 18 '26

How do you do that in z/OS?

2

u/MarcoGreek Mar 18 '26

Do we spoke about RHEL? Is IBM not making big commercials for container on z/OS? But actually I never deployed there.

1

u/pjmlp Mar 18 '26

Sure if want to deploy on z/OS UNIX environment, instead of classic z/OS language environment.

And it was only one example, I can come up with others that we have customers on.

2

u/MarcoGreek Mar 18 '26

The question is that this customers are worth the costs.

2

u/MessElectrical7920 Mar 18 '26

If the customer is paying you to deliver your software for z/OS, it‘s probably worth the cost.