News for hackers. Stuff that matters.
Re:A Guide to Undefined Behavior in C and C++ (2010) by flohofwoe on Sunday November 04, 2018 @06:57AM (#18375446)
It's not like you stumble over UB in your daily work in C/C++, you know it exists, you know which areas to avoid, you compile and test on the 3 "big" compilers (gcc, clang, cl.exe). On clang, test with UBSan enabled.

UB isn't "crazyness" it's just a detail to be aware of.

A compiled binary that worked correctly won't suddenly run into undefined behaviour, that can only happen if you upgrade compiler versions or change compilation flags. But this only happens while the application is still actively developed and tested.

Re:A Guide to Undefined Behavior in C and C++ (2010) by the_why_of_y on Sunday November 04, 2018 @07:26AM (#18375544)
That presumes that your testing process will find the input that actually triggers the UB in your program before the release.

The CVE history of the major browser vendors indicate that this is currently an unsolved problem for their large C++ applications.

Re:A Guide to Undefined Behavior in C and C++ (2010) by flohofwoe on Sunday November 04, 2018 @08:07AM (#18375673)
Of course, and that's exactly where Rust makes sense. Few pieces of software are as safety-critical and complex as a browser though, that's why I'm not a fan of the general "UB scaremongering" ;)
Re:A Guide to Undefined Behavior in C and C++ (2010) by s3cur3 on Sunday November 04, 2018 @10:44AM (#18376357)
Full-time C++ game dev of ~5 years here. I absolutely run into UB issues at least once a month, sometimes as often as a couple times in a week. I doubt our codebase is of below average quality either. UBsan is a godsend here... without it, this stuff was truly hell to debug.
Re:A Guide to Undefined Behavior in C and C++ (2010) by oconnor663 on Sunday November 04, 2018 @08:40AM (#18375801)
> A compiled binary that worked correctly won't suddenly run into undefined behaviour, that can only happen if you upgrade compiler versions...

Upgrading the compiler version and causing undefined behavior sounds pretty sudden. Here's my favorite story along those lines: http://pzemtsov.github.io/2016/11/06/bug-story-alignment-on-...

Re:A Guide to Undefined Behavior in C and C++ (2010) by ilovecaching on Sunday November 04, 2018 @11:55AM (#18376756)
It isn't just UB. It's ADL, ODR, templates, multiple inheritance, etc. The de facto compatibility with C and its own backwards compatibility are also both curses on C++. C++ also blew their complexity budget in a lot of questionable ways that just makes it hard to keep C++ code maintainable. When things become unmaintainable, they become buggy.
Re:A Guide to Undefined Behavior in C and C++ (2010) by humanrebar on Sunday November 04, 2018 @09:42AM (#18376059)
> It's not like you stumble over UB in your daily work in C/C++...

I don't know. I often help colleagues out with things like preprocessor nonsense and violations of the One Definition Rule.

A lot of it has to do with difficult build and packaging tools. Actually standardizing a module system will be an important step in the right direction.