Sujet : Re: Every D(D) simulated by H presents non-halting behavior to H ###
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.theory comp.lang.cDate : 18. May 2024, 18:01:22
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v2amt2$2sg5s$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
User-Agent : Mozilla Thunderbird
On 5/18/24 12:47, Richard Damon wrote:
On 5/18/24 12:32 PM, James Kuyper wrote:
...>> Such code has undefined behavior "by the omission of any explicit
definition of behavior." (4p2).
Strictly conforming programs cannot have undefined behavior (4p5).
Undefined by the C Standard, but likely defined by the implementation.
"Undefined behavior" is a piece of C jargon. You cannot understand the
meaning of the term by treating it as an ordinary English phrase:
"behavior which has no definition'. Rather, it is defined by the
standard to mean "behavior, upon use of a nonportable or erroneous
program construct or of erroneous data, for which this document imposes
no requirements" (3.4.3p1). To say that the behavior is "Undefined by
the C standard" is redundant - "undefined behavior" has "this document"
built into its definition. It remains undefined behavior as far as the C
standard is concerned, even if some other document does define the
behavior. This is important, because strictly conforming code cannot
have undefined behavior. If the C standard has no definition for the
behavior of some code, it cannot be strictly conforming, even if some
other document does define the behavior.
The code might be perfectly safe to run on a platform where that other
document has authority - but it does so entirely because of that other
document, the C standard says nothing to guarantee the behavior of such
code.