3 ms·
I thought this was the purpose of implementation-defined behavior rather than undefined behavior.
by chc 12y ago
I thought this was the purpose of implementation-defined behavior rather than undefined behavior.
- kazinator 12y agoDifferent programming languages can possibly have different terminology for this. In C, "implementation-defined" behavior hinges around standard language features which have implementation-defined characteristics (which must be provided by an implementation). An example of such is the value of the CHAR_BIT macro in <limits.h> (how many bits in a byte) or the range of type int. It does not mean "anything defined by an implementation": that would be too obvious and clear a use of English.
- kruczek 12y agoUndefined behaviour means that anything can happen - also it may happen that particular implementation has such behaviour well defined ;)
- dllthomas 12y agoI had the same thought. The difference may be that the standard says implementations must define "implementation defined" behavior. On reflection, it would seem uncharacteristic for the standard to insist that undefined behavior never be defined by the implementation.
- marvy 12y agoUndefined means: the implementation can choose to define it, or can choose to leave it undefined. The standard prefers implementation defined when it's cheap, but some times it's not.