News for hackers. Stuff that matters.
Re:C23: A Slightly Better C by janice1999 on Sunday January 21, 2024 @03:03PM (#39082420)
C++ is a better C in the same way that a Cybertruck is a better bicycle.
Re:C23: A Slightly Better C by tyree731 on Sunday January 21, 2024 @03:42PM (#39082838)
Nah. More like C is a bunch of hand tools, and C++ is those same hand tools, plus a bunch of power tools. Sure, you could just use the hand tools, and hey maybe they even give you a better of sense of what you’re building at a low level, but it’s exhausting, and it turns out the power tools are really useful.
Re:C23: A Slightly Better C by janice1999 on Sunday January 21, 2024 @03:46PM (#39082871)
Some of C++ features are great, as recently discussed on the Linux kernel mailing list. However for many of Cs usecases, they are not appropriate, like exceptions and RAII in embedded. Once you start disabling major features those 'power tools' become far less attractive. Also, to extend the metaphor, hand tools are usually obvious and easy to use while power tools can have very long manuals. See for example the 275 page book on just Initilisation in C++ [0].

[0] https://www.cppstories.com/2022/cpp-init-book/

Re:C23: A Slightly Better C by spacechild1 on Sunday January 21, 2024 @04:39PM (#39083343)
How is RAII a problem on embedded platforms? It is basically about scoped cleanup, something you would otherwise have to do manually.
Re:C23: A Slightly Better C by actionfromafar on Monday January 22, 2024 @07:41AM (#39088854)
Not sure what waa meant but what comes to mind to me who has dabbled in embedded is that in C it’s painfully clear how long “objects” live and when you tear them down and how. In C++ stuff can easily “happen” at an inopportune moment.
Re:C23: A Slightly Better C by mgaunard on Monday January 22, 2024 @09:45AM (#39090009)
Same in C++: happens at the end of the scope. You precisely control where that is.
Re:C23: A Slightly Better C by PaulDavisThe1st on Sunday January 21, 2024 @03:26PM (#39082682)
funny, but false.

the only sense in which the relationship between C & C++ is like that of a cybertruck to a bicycle is the one in which the latter are "transportation devices" and the former are "programming languages". there is no particular feature of a bicycle represented by a cybertruck other than "it gets you somewhere".

Re:C23: A Slightly Better C by janice1999 on Sunday January 21, 2024 @03:39PM (#39082809)
Yes, that's literally the point I was making.
Re:C23: A Slightly Better C by PaulDavisThe1st on Sunday January 21, 2024 @04:52PM (#39083457)
Sure, but it's wrong. There's a ton of features of C present in C++. You might not like the C++ context they are present in, but it's nothing at all like the cybertruck/bicycle (non)relationship.
Re:C23: A Slightly Better C by pjmlp on Sunday January 21, 2024 @04:50PM (#39083440)
I guess some people are happy with a macro Assembler with a better syntax than MASM/TASM/NASM/yasm high level macros.