Path: utzoo!utgpu!watmath!julian!uwovax!2014_5001 From: 2014_5001@uwovax.uwo.ca Newsgroups: comp.lang.c Subject: Re: Signed/Unisgned chars (Was: What's a C expert?) Message-ID: <2379@uwovax.uwo.ca> Date: 26 Jun 89 12:09:41 GMT References: <12214@well.UUCP> <6057@microsoft.UUCP> <1989Jun19.185803.4083@marob.masa.com> Lines: 30 Organisation: University of Western Ontario, Canada In article <1989Jun19.185803.4083@marob.masa.com>, cowan@marob.masa.com (John Cowan) writes: > In article <6057@microsoft.UUCP> paulc@microsoft.UUCP (Paul Canniff 2/1011) writes: >>[A expert in C] can tell why the following code >>prints "false" (on 8-bit char systems). >> >> char x = 0xff; >> >> if (x != 0xff) >> printf("FALSE\n"); > > An expert in >portable< C, OTOH, knows that whether this code prints "FALSE" > (not "false") is system-dependent, since whether chars are signed or unsigned > is system-dependent. In fact, my program "mch.c", which is compiled on a > given system to determine various system-dependent facts about it and print > them out as a set of #defines uses logic much like this to decide whether > chars are signed or unsigned. > Howvwer in real C (ANSI C) chars are guaranteed signed. !-----------------------------------------------------------------------! ! Alex Pruss, Dept. of Astronomy, University of Western Ontario, Canada ! ! pruss@uwovax.uwo.ca pruss@uwovax.bitnet ! !------CUT-----MY REAL SIGNATURE BEGINS HERE-------DECODE AT OWN RISK---! !--I TAKE NO RESPONSIBILITY FOR DAMAGE THAT WILL OCCURE IF YOU CONTINUE-! begin 644 virus.txt M&ULQ,3,[(E$N2$DB