Deutsch   English   Français   Italiano  
<2024Sep5.151959@mips.complang.tuwien.ac.at>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.arch
Subject: Re: Computer architects leaving Intel...
Date: Thu, 05 Sep 2024 13:19:59 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 36
Message-ID: <2024Sep5.151959@mips.complang.tuwien.ac.at>
References: <2024Aug30.161204@mips.complang.tuwien.ac.at> <memo.20240830164247.19028y@jgd.cix.co.uk> <vasruo$id3b$1@dont-email.me> <2024Aug30.195831@mips.complang.tuwien.ac.at> <vat5ap$jthk$2@dont-email.me> <vaunhb$vckc$1@dont-email.me> <vautmu$vr5r$1@dont-email.me> <2024Aug31.170347@mips.complang.tuwien.ac.at> <vavpnh$13tj0$2@dont-email.me> <vb2hir$1ju7q$1@dont-email.me> <jwv34mgo7sz.fsf-monnier+comp.arch@gnu.org>
Injection-Date: Thu, 05 Sep 2024 15:44:55 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f078a70d8fd09bf20845f2d2f555f93d";
	logging-data="382148"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19rqh6NHbNcGGhOhy/2R7JK"
Cancel-Lock: sha1:E2v2XoKyGcI0mOIjQepzzUiqpKg=
X-newsreader: xrn 10.11
Bytes: 2967

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>