Live data from Hacker News

C++ creator rebuts White House warning

infoworld.com

41–50 of 65 posts

Re: C++ creator rebuts White House warning

#41
post #39
post #3

> I find it surprising that the writers of those government documents seem oblivious of the strengths of contemporary C++ and the efforts to provide strong safety guarantees No, Bjarne needs to realize that RAII and smart pointers are an old concept now, and they have shown to be insufficient, for decades now. The bar for safety has been raised, and the Modern C++ is so behind, they don't even understand the issue, a…

Anecdotally, I feel like I wrote safer C code because at least I fully understood the behavior of the few standard library functions I used - both the good and the bad. C++ always had that question mark of if you were fully understanding all of the invariants the library placed on you to uphold. That being said, I've fallen in love with Rust and have no intention of ever going back to C or C++.

I have a big gripe with rust and other modern languages like zig, and it’s difficult to reconcile it.

The gripe is that after using them for a while, anything else like java, python, c++ or C is underwhelming, boring and tedious, an exercise in how long you can uphold standards until you fall back to language defaults.

Re: C++ creator rebuts White House warning

#43
post #15
post #8

About a year ago, Stroustrup wrote a similar response[0] to a similar statement from the NSA[1]. I wasn't really convinced and am more in agreement with this response to Stroustrup[2] from an embedded Linux developer. To quote from near the end of their response to Stroustrup: > In the meantime, it is unfair for Dr. Stroustrup to call safe programming languages novelties or to pretend that C++ isn’t already far behin…

C and C++ are HARD to use correctly, but how many of those 60-70% vulnerabilities would have been resolved by just compiling with llvm address sanitizer? It would have stopped virtually all of them? https://llvm.org/pubs/2006-05-24-SAFECode-BoundsCheck.pdf https://clang.llvm.org/docs/AddressSanitizer.html In many cases we already have the tools. The problem is that people are not using them. That said it is still in…

They are hard to use when you absolutely want to use them the hard way, std::span can provide you lots of safety, but people don't use available tools.

Re: C++ creator rebuts White House warning

#44

Stroustrup as always fails to recognize the vast surface area of C++ features, foot cannons, and the heavy weight of C compatibility around C++ neck. C++ barely made sense in 1995. It makes absolutely no sense today.

Versus C, it definitly made lots of sense.

For me it was the only language I could see myself using after getting used to Object Pascal quality of life, in tooling, type safety, and language features.

C felt jurassic already in 1993, and there wasn't any other portable alternative I could reach for.

However that copy-paste compatibility with C is what definitly has made it unsuitable for writing safe code nowadays, specially with the C culture that is now left.

Those of us that like C++, but also are on the safety side, have already embraced other programming languages, relegating C++ for the absolute must use cases.

Re: C++ creator rebuts White House warning

#45
post #15
post #8

About a year ago, Stroustrup wrote a similar response[0] to a similar statement from the NSA[1]. I wasn't really convinced and am more in agreement with this response to Stroustrup[2] from an embedded Linux developer. To quote from near the end of their response to Stroustrup: > In the meantime, it is unfair for Dr. Stroustrup to call safe programming languages novelties or to pretend that C++ isn’t already far behin…

C and C++ are HARD to use correctly, but how many of those 60-70% vulnerabilities would have been resolved by just compiling with llvm address sanitizer? It would have stopped virtually all of them? https://llvm.org/pubs/2006-05-24-SAFECode-BoundsCheck.pdf https://clang.llvm.org/docs/AddressSanitizer.html In many cases we already have the tools. The problem is that people are not using them. That said it is still in…

The problem is that there are more compilers out there than clang, and clang isn't available everywhere.

Re: C++ creator rebuts White House warning

#46
post #15

Earlier quoted context omitted.

C and C++ are HARD to use correctly, but how many of those 60-70% vulnerabilities would have been resolved by just compiling with llvm address sanitizer? It would have stopped virtually all of them? https://llvm.org/pubs/2006-05-24-SAFECode-BoundsCheck.pdf https://clang.llvm.org/docs/AddressSanitizer.html In many cases we already have the tools. The problem is that people are not using them. That said it is still in…

They are hard to use when you absolutely want to use them the hard way, std::span can provide you lots of safety, but people don't use available tools.

It provides none, unless you are using C++26 compiled with hardned standard library mode.

If you care about safety use gsl::span instead.

Re: C++ creator rebuts White House warning

#48
post #3

> I find it surprising that the writers of those government documents seem oblivious of the strengths of contemporary C++ and the efforts to provide strong safety guarantees No, Bjarne needs to realize that RAII and smart pointers are an old concept now, and they have shown to be insufficient, for decades now. The bar for safety has been raised, and the Modern C++ is so behind, they don't even understand the issue, a…

The problem is that he is shouting to windmills, because the community at large doesn't care about all the features and tooling he keeps mentioning. Also some of that tooling is still quite buggy, e.g. VC++ and clang lifetime checkers.

Same applies to Herb Sutter's efforts, as of his recent blog post.

It doesn't matter how much tooling there has been available on the C and C++ ecosystem, a large majority will keep programming as they always did unless forced by external factors to change their ways.

Lint was created in 1979, and to this day many developers refuse to adopt static analysis on their C and C++ projects, let alone more modern tooling.

Technology cannot change community culture.

Re: C++ creator rebuts White House warning

#49
post #14
post #9

I agree; you can write perfectly safe and noncompromisingly performant code in C++ much better than any language today. It's genuinely difficult to understand why Rust gets rammed down everyone's throats lately; do they really think developers coming out of universities today are too stupid to grasp memory management? If that's the case, why not have everyone code in Scratch? That memo reads like "to avoid wet pants,…

We've been trying the "just don't write bugs" strategy for over 40 years now, and it's not working. Framing this as a problem with people being too stupid is a completely unproductive mix of hubris and elitism. In the disciplines where real safety is required (like engineering, aviation, medicine), it's accepted that people will make mistakes. When a system can fail catastrophically due to a simple human error, it's…

See log4j vulnerability, you still need "just don't write bugs" with safe languages. What was really tried was "use C the hard way", which fails regularly as one can expect. Projects that use C the easy way have much better safety.

Re: C++ creator rebuts White House warning

#50
post #4

> Of the billions of lines of C++, few completely follow modern guidelines AKA, we’ve created a messy monster that’s out of our control, please don’t blame us.

But it seems like blaming the inventor of knives for using them dangerously? Knives are really useful for cutting things.

The same goes for cars. Thousands of people have died in car accidents yet nobody is proposing that we replace cars because if you use them correctly they really are quite useful.

The same goes for C++. I see a lot of C++-bashing on this thread (it seems very popular on HN?) but it is a useful language. I have worked with plenty of people who used it wrong but to throw the entire thing into the bin is blaming the wrong thing. People can be dangerous drivers even if the car is really good.

Post reply on HN