Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
thebiochemic3019247dStroustrup gives some very good points.
The thing is the notion of guarantees falls apart the moment, anyone in the chain of tools and libraries is using C style pointers/casts etc. As long as this failure vector exists, it will be tricky to answer. -
Demolishun34913247d@thebiochemic I don't know if you can get away from that issue in our lifetime. We are incorporating a C library in our new code because there really isn't anything else. The code is certified for industrial code use by a 3rd party. Most other libraries are really too far behind. None of them have any pedigree.
C++ forces the user to have some understanding about lifetime of memory. I am not sure that is really a bad thing. It is still a systems level language. Maybe C++ should adopt what game engines do. Created a higher level scripting like language that communicates to the lower level C++ code. The high level stuff can be business logic, while the lower level is high speed implementation details. I always liked this relationship of Python to C. -
LotsOfCaffeine4303247dC++ has a long way to go I believe but I get that it's annoying for him to see "C/C++" everywhere, as he calls it an "imaginary language".
The problem is that many C++ codebases also include C parts. I mean, it is the biggest advantage, you can start introducing C++ into an existing C codebase and start using a proper language (yes I'm on shitting on C here) bit by bit.
But many devs, especially the "old school" ones still don't understand the core basics of C++. They never heard of RAII, despite using it with e.g. lock_guard.
Like the amount of times I've seen a malloc for an array in a codebase that was written with C++11 available, or one colleague who wrote it in the same function with vectors, maps, etc. is just insane to me.
If you know C++ decently well it's a good language to write well defined, safe code. Many people just don't, and well it's very easy to get into that magic undefined behavior area imo. -
thebiochemic3019247d@electrineer i guess that's fair.
Atleast you can find unsafe blocks and Box::leak with a lexical search, instead of a full blown static analyzer, but this point still stands yeah. -
CoreFusionX3422247d@Demolishun
When dealing with C libraries it's often simple to just wrap the desired create/destroy pairs into a RAII class, forward any other functions needed, and go ham with smart pointers. -
CoreFusionX3422246d@Demolishun
You know, I do think that if C++ hid all its implicit C compatibilities (C casts, cstdlib, raw pointers...) under the very explicit 'extern "C"' blocks and renamed 'extern "C"' to something like, I dunno, "unsafe", things like rust would have never seen the light of day XD. -
AleCx0428239246dI agree with all points given here and I personally don't have any hate against any of the 3 languages mentioned thus far (even tho C++ is life) but i am gonna troll hard af so when Rust developers look down on my modern c++ code (which I get to write because I don't maintain legacy c++ sh) I usually tell them that their preference for Rust over c++ is a skill issue.
Before any autistic neckbeard comes at me: I love Rust
And I kinda got the feeling that Bjarne said something within the same realm
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
elgringo41Student - Teacher renaming .c to .exe make the program executable ? Teacher - Yes A group of people stand up...
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
So Stroustrup tells the White House: Fuck you, C++ isn't C (paraphrased):
https://infoworld.com/article/...
Go get em Bjarne!
random
c
safety
c++