Sujet : Re: Bart's Language
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 22. Mar 2025, 16:41:23
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vrmln3$7dks$1@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla Thunderbird
On 3/22/25 10:37, Waldek Hebisch wrote:
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
...
Valid responses to undefined behavior include "terminating a translation
or execution (with the issuance of a diagnostic message)". 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.
This was probably subject to previous disscussion here, IIRC
some posters here claimed that even in such case implementation
is supposed to produce an executable.
There is no such requirement. Could you identify who made such a claim,
when, with what arguments? My newserver's archives only go back three
months, and if the claim was made by somebody I've got killfiled, I
won't be able to see it even during that time period. Google Groups
stopped archiving new messages quite a while ago. Therefore, it might be
best to quote the relevant text, rather than merely identifying it.
However, certainly
implementation must accept the program when code that would
exhibit undefined behaviour is not executed. And in practice
when using separate compilation compiler normally is not
able to decide if a function will be called or not (and even
when whole program is available compiler still have halting
problem to solve). So cases when compiler is allowed to report
compilation error are quite limite in practice.
Keep in mind that the Halting problem is difficult only because the
decider must handle every case. Compilers are, in practice, able to
detect many cases of undefined behavior, even though they are not
capable of detecting them all.