Originally posted by lowflyer
View Post
Second, from one side batteries included but i do not agree entirely with it. In my opinion one of the features of good language is if you have to do something potentially shooting you in foot you should be quite explicit. It is opinion you might disagree with it, but when error happens in C and you track down which line crashes most of time (not always) you see ah yea makes sense stupid me. In Rust you would have to explicitly use unsafe. Garbage collected languages will be doing a lot of responsibility for you and will take out gun from your hand.
Third. C++ without most std features is very lacking. Like to use modern C++ you need to use smart pointers. But smart pointers are part of std. And at that point i totally disagree with you. By example Java with just the most basic library (let's say using files/input/output) and Java using more standard library like maps, hashmaps and many other stuff and in principle code changed very little. You can look at C code written for microcontrollers, for kernel and for userspace, and sure some libraries are different but in principle things will change very little (like malloc vs kmalloc etc.). You will understand code (just not understand platform specific stuff). Modern C++ when you can use either std or boost or Qt stuff, and C++ embedded/for kernel will be entirely 2 different worlds.
Forth. You can compile C code as C++ code but you cannot compile C++ code as C code. And when Astree supports subset of C++ (and only up to C++17, none C++20 stuff), in C you have big collection of options, like Frama-C, Misra-C, Astree, you have even Compcert C compiler that is formally proven entirely. Rust already has Ferrocene compiler despite being fresh language and MIRI.
About style guides - i am talking about style guide from same company - google. Google has python style guide. It is both shorter and way more expressive then C++ one (and python gives long code examples. C++ is longer and not even verbose. By giving Python style guide from somewhere you compare apple to oranges.
"That's an old trope. Assembly output is far less important these days." - Linus still cares about it.
Personally for me, I have no reason to use C++. If I write userspace without extreme requirements for performance, i will use Go. Simple easy safe great concurency. If i have to be that performant - Rust. Kernel - Rust is good. And if i have to be extremly performant (like dav1d class performant, database performant) - sorry you have to write assembly and use probably C to interact with it.
Comment