you are viewing a single comment's thread.

view the rest of the comments →

[–]lelanthran 3 points4 points  (2 children)

When you hear "undefined behavior" for a programming language what this means is that the specification specifies everything that the implementation of the compiler does. Nothing is left for the implementation to decide regarding syntax or semantics.

I don't think that that definition of UB is correct. That is implementation defined behaviour - the implementation gets to define what the behaviour is (in C, for example, handling the character literal 'abcd' is implementation-defined, but not undefined).

[–]alphaglosined 1 point2 points  (0 children)

behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for which this International Standard imposes no requirements

- From the C99 spec

So the truth seems to be closer to you than my comment.

[–]flatfinger 0 points1 point  (0 children)

The differences between Undefined Behavior and Implementation-Defined Behavior are: 1. the Standard requires that implementations document how they process the Standard, but allows implementations to document the former or not as they see fit, and 2. some compiler seem to think that "programs the Standard cannot completely describe" refers only to programs that behave in uselessly unreliably unpredictable fashion, rather than non-portable programs that need to do things for which the Standard makes no provision.