5 ms·
> I wish they would have some kind of super strict mode for C or C++ where compilation fails unless you somehow fix things at the call sites to tell the compile
by jjmarr 2y ago
> I wish they would have some kind of super strict mode for C or C++ where compilation fails unless you somehow fix things at the call sites to tell the compiler the behavior you want explicitly.
The C++ language committee _does not_ want to add more annotations to increase memory safety.
- tialaramex 2y agoSeveral programming languages can testify to the fact than a Benevolent Dictator For Life is not a panacea. Several more than testify that having a Committee to design the language is likewise not a panacea. Perhaps uniquely C++ can clarify for us that both is in fact worse than either alone.
- pjmlp 2y agoSame applies to C.
- tialaramex 2y agoDo you see Brian and Dennis dominating WG14 meetings? Nope. They moved on, Bjarne Stroustrup never did. After his initial prototypes and his first book about C++ he's written lots more books and papers, he's lectured classes, he's given huge numbers of talks, all of them about his baby, C++. If you ask WG21 people directly they'll insist he's just one vote (ah yes, JTC1 consensus "voting") but for example WG21 says it will heed the "advice" of its Direction Group, a self-selecting handful of people which is dedicated to following advice from a book written by Bjarne and weirdly always giving exactly the same advice as Bjarne, which makes sense because its most notable member is Bjarne but this advice is signed "The Direction Group" ... It's like being surprised that the UN Security Council keeps making decisions which favour Russia.
- pjmlp 2y agoIt doesn't change the fact C is equally a design by committee language with all the negativity it entails. In fact, WG14 very clearly has acted against Dennis when he submitted papers that could have improved C's safer. Maybe his fat pointers proposal was not good enough, but apparently is wasn't something worth improving upon either. C authors indeed moved on, first with Alef (which granted had a few design issues), Limbo and finally Go, as C as being driven by WG14 was no longer their thing, C on Plan 9 isn't even C89 compliant.
- anon-3988 2y agoNot even annotations. The committee standardize this https://en.cppreference.com/w/cpp/container/span/operator_at https://en.cppreference.com/w/cpp/container/span/operator_at So they clearly doesn't care so there's no point convincing them.
- maxlybbert 2y agoThe committee tends to also provide bounds checked interfaces ( https://en.cppreference.com/w/cpp/container/span/at https://en.cppreference.com/w/cpp/container/span/at ). But that requires people read the documentation, and based on the number of people who I see write "std::endl" when they really want "'\n'", I don't have much hope for that ("std::endl" both sends '\n' to the stream, and flushes it; people are often surprised about the stream getting flushed).
- AlotOfReading 2y agoWe've known since the 80s that programmers almost always choose the more ergonomic interface and telling people they're holding it wrong doesn't scale. Besides, throwing an exception is a terrible way to do range checking. There's a huge number of projects out there banning exceptions that would benefit from safe interfaces.
- shiomiru 2y ago> Besides, throwing an exception is a terrible way to do range checking. There's a huge number of projects out there banning exceptions that would benefit from safe interfaces. I thought "banning exceptions" would mean fno-exceptions, turning the throw into an abort - that's pretty good for a systems programming language, no? What other way would you propose?
- anon-3988 2y agoMake it explicit that the API can fail. Panicking is not acceptable in systems programming. Force me to handle all the cases.