Undefined behaviour
Undefined behaviour
Posted Sep 10, 2018 15:08 UTC (Mon) by anselm (subscriber, #2796)In reply to: Undefined behaviour by Wol
Parent article: C considered dangerous
I would have thought that the C spec should have said "When behaviours are undefined because different hardware behaves differently, it is down to the compiler writers to provide a definition for their implementation".
The C standard, at least back when I was still programming in C, did in fact make that distinction. When dealing with a C implementation, you distinguish between behaviour that is specified in the standard, “implementation-defined behaviour” that is not specified in the standard but requires a consistent (and documented) approach by the implementation, and “undefined behaviour”, where anything can happen, including unpredictable and inconsistent effects.
