26 ms·
C++ is already a better C. So much so that new revisions of C are just backporting features at this point.
by mgaunard 3y ago
C++ is already a better C.
So much so that new revisions of C are just backporting features at this point.
- z_open 3y agoC++ and C are no longer used for the same types of projects so C++ is not a better C.
- pjmlp 3y agoUntil C fixes its string and array story, C++ keeps being a better C.
- mgaunard 3y agoI think you must be from the 90s -- if so can you share your time machine? All kinds of major projects switched to C++ already, for example GCC. All the major new projects, for example LLVM, are also in C++ from the get-go. Even the Linux kernel is considering switching to C++ now.
- leosanchez 3y ago> Even the Linux kernel is considering switching to C++ now. Source?
- mgaunard 3y agohttps://www.phoronix.com/news/CPP-Linux-Kernel-2024-Discuss https://www.phoronix.com/news/CPP-Linux-Kernel-2024-Discuss
- franzb 3y agohttps://lore.kernel.org/lkml/3465e0c6-f5b2-4c42-95eb-29361481f805@zytor.com/ https://lore.kernel.org/lkml/3465e0c6-f5b2-4c42-95eb-2936148...
- kleiba 3y agoI wonder if Linus has changed his views on C++ too in the mean time. http://harmful.cat-v.org/software/c++/linus http://harmful.cat-v.org/software/c++/linus
- liquid153 3y agoNo they’re not
- rzzzt 3y agoA weird way to spell "Rust".
- mgaunard 3y agoI giggled -- thank you.
- andoaaaaz662 3y ago[dead]
- riku_iki 3y ago> Even the Linux kernel is considering switching to C++ now. considering doesn't mean it will happen in near future, because toolchains/ecosystem is not there, the same is applicable for many other projects.
- mgaunard 3y agoI'm not aware of any toolchain limitations; making the kernel compile as C++ is doable with a few trivial patches, and the kernel already is heavily GCC-specific, which supports both C and C++ to the same level.
- EasyMark 3y agoI have my doubts on c++ ever making it into the mainstream kernel while Torvalds is benevolent dictator. Especially since there is rust. I agree with the rest of what you said though.
- janice1999 3y agoC++ 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/
- deleted 3y ago[deleted]
- Xeamek 3y ago'just backporting [good] features' doesn't sound that bad when c++ is widely considered the most bloated mixture of the good, the bad and the ugly that there is. Maybe the c++ killer will turn out to be just some future, modern version of C...
- bluetomcat 3y agoC++ is a different animal of a language. It is about compile-time meta-abstractions that generate a ton of invisible code under your feet. It has complex expression semantics and a crowded syntax space.
- deleted 3y ago[deleted]
- EasyMark 3y agobut this post is about c++ 23 and probably should stay on that topic? Everyone who uses c knows you can do it in c++ but either don't want to introduce the extra complexities, work with older code bases, prefer the "simplicity" of c, or have an organizational requirement. Personally on embedded I like c++, especially raii, smart pointers, containers, and classes, but I completely avoid rtti, exceptions, and complex template metaprogramming (by me). That subset is easy to keep in my head and on my projects. However some clients want C, and that's what I give them.