Path: csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: "The long goodbye to C" by Eric Raymond Date: Wed, 15 Nov 2017 11:13:17 -0800 Organization: None to speak of Lines: 32 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="8cb74c8c010586bd290695b6b8300a1f"; logging-data="5994"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181BPDL3vg4OorKTEXJHk+3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:YyVBoYcbOG5fqEuOCdeC8kRf3Cg= sha1:cKt8B5P5TvgCzQyqUGULRmCcqgw= Xref: csiph.com comp.lang.c:122622 supercat@casperkitty.com writes: [...] > For example, on a 16-bit two's-complement platform with silent-wraparound > semantics, given "int i=32767", it would not be astonishing for "long l=i+1;" > to set l to -32768. Programmers familiar with the platform might or might > not be astonished if l were set to +32768, but setting it to -32768 should > not be astonishing in any case. I agree, that would not be astonishing. The behavior is undefined, so any behavior is permitted, but setting l to -32768 would be, I suppose, particularly unsurprising. A compile-time warning would also be unsurprising. A conforming C compiler is free to implement that behavior, either by default or in response to a compile-time option. > I'm not sure why some people seem to think "behave in a manner that would be > non-astonishing to someone familiar with the underlying platform" is not a > workable specification, given that C was flourishing under such semantics > long before any "official" standard was written. Are you suggesting that the C standard should require implementations to "behave in a manner that would be non-astonishing to someone familiar with the underlying platform"? It's not a workable specification because it's vague. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"