News for hackers. Stuff that matters.
Re:The Resurgence of C Programming by loup-vaillant on Tuesday December 27, 2016 @03:30PM (#13265948)
(f) Does this mean they'll remove some undefined behaviour? Or at least mandates options to that effect? That would be marvellous.
Re:The Resurgence of C Programming by wangchow on Tuesday December 27, 2016 @03:46PM (#13266037)
I tend to read undefined as don't do it
Re:The Resurgence of C Programming by syncsynchalt on Tuesday December 27, 2016 @08:53PM (#13267862)
It's not always possible / feasible to avoid undefined operations.

Use the modulo operator? Undefined unless you checked for negative first.

Add two integers? Undefined unless you check for overflow.

Granted those examples get a pass because on modern two-complement architectures everything handles the undefined behavior in an identical way.

Re:The Resurgence of C Programming by loup-vaillant on Wednesday December 28, 2016 @04:53AM (#13269560)
I believe the modulo operator is implementation defined. As should be signed integer overflow, though it isn't.

One big problem about "undefined" is, when some platform go bananas over some stuff, the behaviour is standardised as undefined for all platforms, allowing the compilers to go bananas. Which they do, because every bit of undefined helps them perform some micro-optimization they couldn't do before.

I long for the day where the standard forces compilers to provide options such as -fwrap or -fno-strict on platforms that can reasonably support it.