From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <6B7DA7E3-3917-4A67-9084-1B5DD90D97F9@me.com> References: <1448274004.1751482.447419065.2BE466C4@webmail.messagingengine.com> <6B7DA7E3-3917-4A67-9084-1B5DD90D97F9@me.com> Date: Mon, 23 Nov 2015 12:05:21 +0000 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a1140e226174fdb0525340a3f Subject: Re: [9fans] Undefined Behaviour in C Topicbox-Message-UUID: 76e2c81a-ead9-11e9-9d60-3106f5b1d025 --001a1140e226174fdb0525340a3f Content-Type: text/plain; charset=UTF-8 On 23 November 2015 at 11:50, Brantley Coile wrote: > It is undefined in C whether or not it sign extends or not. Some machines > do it one way, some another. To force the language to one behavior requires > more code on some architectures. > Ironically for its use as an example, that's another case where Plan 9 C defines the effect: char is always signed, unsigned char is the only unsigned form, on all targets, just like int/unsigned int, short/unsigned short. The abbreviation "uchar" makes it relatively painless. It's just a pity that string literals must be char*, not uchar*, and all the str* functions take char*. --001a1140e226174fdb0525340a3f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On 23 November 2015 at 11:50, Brantley Coile <brantleycoile@me.com= > wrote:
It is undefined in C whether or not it s= ign extends or not. Some machines do it one way, some another. To force the= language to one behavior requires more code on some architectures.

Ironically for its use as an example, that's a= nother case where Plan 9 C defines the effect: char is always signed, unsig= ned char is the only unsigned form, on all targets, just like int/unsigned = int, short/unsigned short. The abbreviation "uchar" makes it rela= tively painless.
It's just a pity that = string literals must be char*, not uchar*, and all the str* functions take = char*.
--001a1140e226174fdb0525340a3f--