4
Demolishun
260d

So Stroustrup tells the White House: Fuck you, C++ isn't C (paraphrased):
https://infoworld.com/article/...

Go get em Bjarne!

Comments
  • 3
    Stroustrup 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.
  • 1
    @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.
  • 1
    @thebiochemic you can write unsafe code in rust also
  • 0
    @electrineer or fail to notice a compiler bug.
  • 3
    C++ 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.
  • 0
    @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.
  • 1
    @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.
  • 1
    @CoreFusionX that is what we are doing. Hide all the shit with that.
  • 4
    @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.
  • 2
    I 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
  • 2
    @AleCx04 I have his C++11 book. He trolls other languages a bit in there.
  • 2
    @Demolishun oh fr is it a Bjarne book?
  • 1
    @AleCx04

    https://en.wikipedia.org/wiki/...

    I need to get a newer one though
Add Comment