News for hackers. Stuff that matters.
Re:Modern C for C++ Peeps by saghm on Saturday January 07, 2023 @11:41AM (#34289718)
> There is really no legitimate reason to code C anymore: A C++ compiler is available for any modern development target. Confining yourself to any C subset (with or without ISO C marginalia) amounts to crawling when you can fly. > > To be more specific: nothing that can be done using C is unavailable to the C++ coder, but enormous power is available to the C++ coder and wholly unavailable in C.

As a counterargument, sometimes constraints can be valuable in their own right rather than just being requirements for some larger goal. The most prominent example of this in programming design is type checking; enforcing type checking at compile time strictly reduces the number of programs you can express, so dynamic languages can do everything that static languages and more, and yet it turns out that it's still pretty useful specifically because we sometimes want to avoid the programs that a dynamic language would allow but a static language would reject. At the risk of getting too philosophical, imagine framing programming as an exercise in trying to write rules to specify one program out of the set of all possible programs, where each bug you write that changes the semantics moves one step further from your goal. The compiler can act as a "filter" on the set of programs you can potentially select by refusing to process your rules if they would specify one of the forbidden programs, which reduces the chance selecting the wrong program by mistake. In this scenario, the theoretically ideal compiler would be the one that rejects all programs other than the exact one you want! This obviously isn't possible in the general case, but the point here is that as long as compilers don't reject the exact program you want, a compiler that rejects more programs is _more_ useful.

I'm not making any claim about whether it is in fact worth it to code C anymore, but I disagree with the logic that C++ letting you do anything C can do and more is proof that C++ should always be used over C. Maybe C is crawling compared to C++'s flying, but if my goal is to get a pen that falls under my desk, it's a lot more useful for me to not use an airplane to do it.

Re:Modern C for C++ Peeps by moloch-hai on Saturday January 07, 2023 @11:53AM (#34289879)
Getting your pen doesn't demand enormous power, but you are not obliged to field any, either way.

We generally don't know, when we set out, how much support we will be able to benefit from, down the road.

Re:Modern C for C++ Peeps by galangalalgol on Saturday January 07, 2023 @01:54PM (#34291285)
I think the gp was talking about anti-features. Austral's announcement included a list of features it avoided on purpose. Including several from c++. operator overloading, increment operators and even implicit oder of operations were listed as features that made codebases worse, even if no one has to use them.
Re:Modern C for C++ Peeps by moloch-hai on Saturday January 07, 2023 @03:21PM (#34292299)
Coding by superstition was a bad idea before Austral, and remains a bad idea after.