[Python-Dev] towards a faster Python

Tim Peters tim.one@comcast.net
Mon, 09 Jun 2003 17:12:29 -0400


[Guido]
> I don't think the spirit of C applies here.  I want to be able to tell
> anyone who does one of these things that their program is illegal (or
> invalid, or some other pejorative term), not just undefined, and
> certainly not implementation-defined.  Otherwise a future
> implementation couldn't detect such illegal programs and reject them
> at compile time or at least raise an exception at run-time.

As the C standard uses the word "undefined", compile-time rejection of a
program with undefined semantics is fine.  Nothing is defined about what
happens in the face of undefined behavior, so nobody can object to anything
that happens!

    undefined behavior

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

    NOTE Possible undefined behavior ranges from ignoring the situation
    completely with unpredictable results, to behaving during translation
    or program execution in a documented manner characteristic of the
    environment (with or without the issuance of a diagnostic message),
    to terminating a translation or execution (with the issuance of a
    diagnostic message).

    EXAMPLE An example of undefined behavior is the behavior on
    integer overflow.