From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <1448274004.1751482.447419065.2BE466C4@webmail.messagingengine.com> <6B7DA7E3-3917-4A67-9084-1B5DD90D97F9@me.com> Date: Mon, 23 Nov 2015 12:40:46 +0000 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a1142b97ac2d9b20525348830 Subject: Re: [9fans] Undefined Behaviour in C Topicbox-Message-UUID: 7707c304-ead9-11e9-9d60-3106f5b1d025 --001a1142b97ac2d9b20525348830 Content-Type: text/plain; charset=UTF-8 On 23 November 2015 at 12:17, Brantley Coile wrote: > I've lived with the old definition so long that I didn't notice Plan 9's > definition, which is not a problem on today's architectures because there > are two equally efficient instructions to choose from. There are a few things in C's definition where things aren't specified as portably as they might now be, because they just turned out to be different on different platforms, especially once there were several compiler implementations. An early example of the former is "bit fields", which are such a mess that Plan 9 code never uses them. An example of the latter was the long argument between "value preserving" and "unsigned preserving" for choosing the type when unsigned values met signed ones. "Unsigned preserving" is trivial, and at least easy to understand. ANSI went for "value preserving" (even though it doesn't really preserve values, except in the sense of formaldehyde) and the rules are surprisingly elaborate. --001a1142b97ac2d9b20525348830 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On 23 November 2015 at 12:17, Brantley Coile <brantleycoile@me.com= > wrote:
I've lived with th= e old definition so long that I didn't notice Plan 9's definition, = which is not a problem on today's architectures because there are two e= qually efficient instructions to choose from.=C2=A0

T= here are a few things in C's definition where things aren't specifi= ed as portably as they might now be,
becaus= e they just turned out to be different on different platforms, especially o= nce there were several compiler implementations.
An early example of the former is "bit fields", which are s= uch a mess that Plan 9 code never uses them. An example of the latter was t= he
long argument between "value preser= ving" and "unsigned preserving" for choosing the type when u= nsigned values met signed ones.
"Unsig= ned preserving" is trivial, and at least easy to understand. ANSI went= for "value preserving" (even though it doesn't really
<= div class=3D"gmail_extra">preserve values, except in the sense of formaldeh= yde) and the rules are surprisingly elaborate.
--001a1142b97ac2d9b20525348830--