Sujet : Re: Computer architects leaving Intel...
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.archDate : 05. Sep 2024, 14:19:59
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2024Sep5.151959@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : xrn 10.11
Stefan Monnier <
monnier@iro.umontreal.ca> writes:
Specifications are an agreement between the supplier and the client. The
>
The problem here is that the C standard, seen as a contract, is unfair
to the programmer, because it's so excruciatingly hard to write code
that is guaranteed to be free from UB.
For programs there is no conformance level "free from UB" in the C
standard. There are two conformance levels for programs:
1) A strictly conforming program shall use only those features of the
language and library specified in this International Standard.
This excludes all programs that terminate, including the "Hello,
World" program. And of course it also excludes pretty much all
non-terminating programs.
2) A conforming program is one that is acceptable to a conforming
implementation. So if, say, gcc-10 is a conforming implementation
(and I think that it claims so), and it accepts your program, your
program is a conforming program.
One first would have to agree on whether the program should be
conforming or strictly conforming. In the "strictly conforming" case,
it is indeed hard to write any useful code (I find it even hard to
think of a useful non-terminating program that uses only things
specified in the C standard features). OTOH, conforming programs
include many that exercise undefined, unspecified, or
implementation-defined behaviour, so in that case the C standard does
not serve as specification.
In either case, treating the C standard as agreement is nonsense.
- anton
-- 'Anyone trying for "industrial quality" ISA should avoid undefined behavior.' Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>