3 ms·
My personal feeling is that the compiler writers have gone overboard in their literal interpretation of "undefined behaviour". C on any real world machine has
by bcrl 6y ago
My personal feeling is that the compiler writers have gone overboard in their literal interpretation of "undefined behaviour". C on any real world machine has quite well defined (and expected) behaviour. In the real world we don't expect to have to support 6 bit or 18 bit CPUs today. Numbers are stored in binary, not trinary. The C spec should really be tightened up to define a lot of what was left undefined for these relics of history.
The worst example of undefined behaviour abuse by a compiler is when gcc developers decided it was a good idea to optimize away a NULL pointer check just because the pointer was dereferenced. Seriously? Sometimes I really wonder who comes up with the idea that removing code the developer wrote is OK, but I guess that's the primary goal of any optimizing compiler.