5 ms·
C++ is a better C in the same way that a Cybertruck is a better bicycle.
by janice1999 3y ago
C++ is a better C in the same way that a Cybertruck is a better bicycle.
- PaulDavisThe1st 3y agofunny, 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".
- janice1999 3y agoYes, that's literally the point I was making.
- PaulDavisThe1st 3y agoSure, 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.
- tyree731 3y agoNah. 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.
- janice1999 3y agoSome 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/ https://www.cppstories.com/2022/cpp-init-book/
- spacechild1 3y agoHow is RAII a problem on embedded platforms? It is basically about scoped cleanup, something you would otherwise have to do manually.
- actionfromafar 3y agoNot 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.
- mgaunard 3y agoSame in C++: happens at the end of the scope. You precisely control where that is.
- pjmlp 3y agoI guess some people are happy with a macro Assembler with a better syntax than MASM/TASM/NASM/yasm high level macros.