3 ms·
The compiler may also assume undefined behaviour can happen, and do something documented, that programmers would probably expect. Even though the standard impo
by to3m 10y ago
The compiler may also assume undefined behaviour can happen, and do something documented, that programmers would probably expect.
Even though the standard imposes no specific requirements, it explicitly calls that out at something you could do: http://port70.net/~nsz/c/c11/n1570.html#3.4.3 http://port70.net/~nsz/c/c11/n1570.html#3.4.3
But for some reason nobody seems to ever think this is an option.
- lmm 10y agoIt wouldn't improve benchmark performance, which is what C compiler writers care about. And at this point in time any programmer who wants that kind of behaviour has probably moved on from C.
- lomnakkus 10y agoWell, that and undefined behavior sometimes would require absurd amounts of runtime checking (eg. on signed bit shifts, etc.).