News for hackers. Stuff that matters.
Re:Modern C++ Won't Save Us (2019) by jvanderbot on Sunday April 25, 2021 @08:51PM (#26938197)
Is there a safe subset of C++ defined somewhere? Can I turn off some of these ridiculous "features"? As we add so much to the language, the number of footguns increases quadratically.
Re:Modern C++ Won't Save Us (2019) by PEJOE on Sunday April 25, 2021 @10:52PM (#26938775)
C is still a widely used and beautiful language. It is "safe," in the sense that the machine does more or less exactly what you ask it to. Allocate memory when you need it, and free it when you consume it / are done with it.

You do not have to use these features if you do not want to.

C++ is very powerful, and has an amazing world of libraries available, but sometimes I feel like it is at least two languages at the same time.

For example, one benefit of using C++ over C is writing C style programs with modern libraries and convenient containers in the STL, but you quickly learn that C style programming isn't supported across the board, and hitting that wall can be jarring and unexpected (Looking at you openCV - just try to allocate space for a struct containing a cv::Mat)

Re:Modern C++ Won't Save Us (2019) by pjmlp on Monday April 26, 2021 @02:28AM (#26939840)
Yes, C++ the good parts is known as C++ Core Guidlines,

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines

Re:Modern C++ Won't Save Us (2019) by jvanderbot on Monday April 26, 2021 @11:28AM (#26943550)
This is great stuff. Thanks!

I sympathize that compilers do not do "enough" of this for us. But there's really no substitute for a good code standard and developer culture focused on quality.

Re:Modern C++ Won't Save Us (2019) by pjmlp on Tuesday April 27, 2021 @04:16AM (#26953370)
Unfortunely C++ inherited the perfomance focused culture from C and sees such kind of tooling as needless bloat, only required for developers that need an extra hand while coding.

https://isocpp.org/files/papers/CppDevSurvey-2021-04-summary...

If you check other well known survey among C++ community you will see similar results in static analysis tooling and coding standards adoption.

So while, contrary to the C community, WG 21 members do strive to push the code quality forward and publish tooling that helps to enforce it, the adoption could be much higher than it actually is on the field.