Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: C wish list Date: Sun, 24 Mar 2019 16:38:27 -0700 Organization: None to speak of Lines: 37 Message-ID: References: <18RkE.296542$DH4.255445@fx24.am4> <2J7lE.185089$1p7.119303@fx05.am4> <2PalE.135956$Ef4.37063@fx38.am4> <4BqlE.730757$RBa.544247@fx15.am4> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="784bbd8fb1c90ff7036d4663e7b2295d"; logging-data="28212"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bsRe652FFSSZPwMwm1rOB" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:aevSN0GQztuyVZABDx2h9U8A1UQ= sha1:cXGKFA9cAjM7/gK5r7NMQYdSwkI= Xref: csiph.com comp.lang.c:142381 David Brown writes: [...] > I've already told you. Most languages that I know of which compile to > assembly, and are aimed at high performance code, make signed integer > overflow undefined behaviour. Many tools for these languages provide > some help in debugging such code, with options that inserting run-time > checks (in the same way gcc and clang can do for C and C++). Languages > in this category include Pascal, Modula 2, Fortran, Ada, and Algol. [...] Ada requires an exception to be raised on signed integer overflow. For example, given this code: declare X: Integer := Integer'Last; begin X := X + 1; Put_Line("This should not happen"); end; the Put_Line call will not be executed if the implementation is conforming. (A program can handle the exception and continue normal execution, but the exception transfers control out of the block.) (Ada does have a "pragma Suppress" that can inhibit checks -- but if a check would have been triggered, the program has undefined behavior. There's still no guarantee that X will get any particular value. Ada compilers can have options to suppress checks, but strictly speaking such an option would render the compiler non-conforming.) I don't know about the other languages you mentioned. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */