News for hackers. Stuff that matters.
Re:All C++20 core language features with examples by matheusmoreira on Wednesday April 07, 2021 @05:50PM (#26731836)
Code quality can also be judged by the quality of compiler output. C++ has many language features that allow compilers to generate efficient code. Unfortunately it also features incredibly complex abstractions that lead to insane binary interfaces.

Binary interface complexity is actually a huge reason why people rewrite stuff in C. When you write in C, you get symbols and simple calling conventions. Makes it easy to interoperate.

Re:All C++20 core language features with examples by Aa9C4xPz43Gg7k6 on Wednesday April 07, 2021 @06:38PM (#26732420)
To some degree you can write in C++ and expose C interface.
Re:All C++20 core language features with examples by koyote on Wednesday April 07, 2021 @06:45PM (#26732499)
> C++ has many language features that allow compilers to generate efficient code.

It does, but it also has the ability of generating inefficient code. Sure, it's often the developers fault but I feel like it's much easier to shoot yourself in the foot in terms of performance in C++ compared to other compiled languages.

Some real-life examples for me:

* Missing a '&' for a function parameter resulting in that object being copied for each function invocation

* Adding a couple extra chars to an error message string in an inlined function which caused that function to then be 'too large' to inline according to the compiler