• Re: Bart's Language

    From Tim Rentsch@21:1/5 to Keith Thompson on Sun Apr 27 11:53:05 2025
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

    antispam@fricas.org (Waldek Hebisch) writes:
    [...]

    Well, it is rather easy to see if variable is used within its
    own initialization, so practically it is minor gap. Of course,
    there is problem with C standard: IIUC depending on rest of
    the code declarations as above are merely undefined behaviour
    or even produce unspecified value. So C compiler is
    forbidden to stop compilation are report compile time error.

    Valid responses to undefined behavior include "terminating a translation
    or execution (with the issuance of a diagnostic message)".

    That's true, but doing so is allowed only if the circumstances
    of undefined behavior have occurred. In the case of compiling
    a declaration such as

    int a = a;

    no undefined behavior has as yet occurred.

    In other
    words, if a compiler is able to prove that a program has undefined
    behavior (that will occur on each execution), it can reject it at
    compile time.

    The program can be rejected, but not because of the rule about
    terminating a translation. The program can be rejected because
    the program is not strictly conforming, and implementations are
    not required to accept programs that are not strictly conforming.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)