Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Keith Thompson Newsgroups: comp.compilers Subject: Re: C and archtecture, C and Java, was Compilers :) Date: Sun, 29 Jan 2023 19:37:45 -0800 Organization: None to speak of Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-01-082@comp.compilers> References: <23-01-001@comp.compilers> <23-01-007@comp.compilers> <23-01-051@comp.compilers> <23-01-053@comp.compilers> <23-01-054@comp.compilers> <23-01-077@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="51229"; mail-complaints-to="abuse@iecc.com" Keywords: C, standards Posted-Date: 30 Jan 2023 12:51:42 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:3348 dave_thompson_2@comcast.net writes: [...] >> As well as I know it, C only requires assignment to work for >> pointers cast to (unsigned char *). And once they are cast, >> usually (though I suppose not always), it is done with memcpy(), >> or compared with memcmp(). > > Only unsigned char is 100% guaranteed, but on all known systems today > signed char has no trap rep and also works and so does plain char. [...] The C standard specifically says that signed char has no padding bits (N1570 6.2.6.2p2). And plain char has the same representation as either signed char or unsigned char, so it also has no padding bits. On the other hand, it's best to use unsigned char to access the underlying representation. The standard defines the "object representation" of a value stored in an object in terms of copying it into an array of unsigned char (N1570 6.2.6.1p4). And C still (until C23) doesn't mandate 2's-complement for signed types, so that's another layer of confusion you can avoid by using unsigned char. (all-bits-1 could be a trap representation.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for XCOM Labs void Void(void) { Void(); } /* The recursive call of the void */