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.

192 Upvotes

100 comments sorted by

View all comments

Show parent comment

-6

u/Serious-Regular Mar 18 '26

Um I have no idea what you're trying to say - c++20 isn't less portable than c++17 (that would make no sense - they're both standards....). Ironically enough the reason we (LLVM) haven't bumped std is because not all compilers have full standard support specifically clang.......

Edit: ah shit I didn't notice I was responding to pjmlp the king of cpp/compiler trolls 🀦

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.

→ More replies (1)

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?

→ More replies (9)

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.

3

u/pjmlp Mar 18 '26

Glad to have won a title, maybe I should have that as flair.

So you answer yourself that "haven't bumped std is because not all compilers have full standard support specifically clang......." and I am the troll.

We write code that is supposed to compile in any compiler, not having to have cppreference open or its successor, to see what "Can I use" that works in all target compilers.

1

u/MarcoGreek Mar 18 '26

We write code that is supposed to compile in any compiler, not having to have cppreference open or its successor, to see what "Can I use" that works in all target compilers.

So you write C89? πŸ˜‹

2

u/pjmlp Mar 18 '26

I avoid writing C as much as I can since 1993, I agree with Microsoft point of view that we should have nuked C long time ago.

Reader Q&A: What about VC++ and C99? from Herb Sutter.

Even though with Microsoft <3 Linux and FOSS, support for C11 and C17 has been added.

So if I do have to write C, all our target compilers do at least support C11, no need for C89.