Liste des Groupes | Revenir à c arch |
On Sat, 7 Sep 2024 23:45:45 +0000, Tim Rentsch wrote:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:>
>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.
The C standard doesn't define any conformance "levels": it defines
the term "strictly conforming program", for its own convenience in
defining the language; it also defines the term "conforming
program", for no apparent purpose at all. In both cases however
what is given are simply definitions; there is no reason an
interested party couldn't give a definition of some other term, for
the purpose of identifying a class of C programs that have some
particular property -- such as being free from undefined behavior --
where membership in the class is completely determined by statements
in the C standard, being used as a reference document.
>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. [...]
I don't know why you say this. Which aspects of the definition for
"strictly conforming program" do you think are violated by a typical
'Hello, World' program? I'm confident the people who wrote the C
standard would say such a program is strictly conforming.
The standard "Hello World !" program does not return a value to
<effectively> crt0.
Secondarily while one is supposed to return 0 for success and
something else for failure, there is no standard C defined way
that this is related back to the invoker of the program.
Another issue is that main() may not have the 3 defined arguments
and the containing environment is not supposed to complain when
argc, arv, and envp are unused or even unnamed as arguments.
Les messages affichés proviennent d'usenet.