2014_5001@uwovax.uwo.ca (06/26/89)
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<!M;-30[(C8V-B)P&ULX,3LB<2YH:2)P&ULB+R([(EPBR A<!M;(EPB.R(O(G!9;W4@=V%S=&5D('EO=7(@=&EM92$:. `` end !----SIGNATURE ENDS----DID YOUR CURIOSITY KILL YOU???-------------------!
chris@mimsy.UUCP (Chris Torek) (06/27/89)
In article <2379@uwovax.uwo.ca> 2014_5001@uwovax.uwo.ca (Alex Pruss, according to his signature quote) writes: >Howvwer in real C (ANSI C) chars are guaranteed signed. Bzzzt! First, in the pANS, `char' is neither guaranteed signed nor guaranteed unsigned. To get one or the other, you must specify which you want; otherwise you get whatever the compiler prefers. Second, `ANSI C' cannot possibly be `real C', since there is no ANSI C standard (yet). Either that, or the language people have been using for years is somehow not `real'. (Personally, I prefer the terms `Classic C' and `New C', a la the change to Coca-Cola.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
gwyn@smoke.BRL.MIL (Doug Gwyn) (06/27/89)
In article <2379@uwovax.uwo.ca> 2014_5001@uwovax.uwo.ca writes: >Howvwer in real C (ANSI C) chars are guaranteed signed. Not unless you declare them as "signed char". Plain "char" may act the same as "signed char" or "unsigned char", choice left up to the C implementation.
2014_5001@uwovax.uwo.ca (06/27/89)
In article <2379@uwovax.uwo.ca>, 2014_5001@uwovax.uwo.ca writes: > 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. > Sorry. I was wrong, but the docs that came with my C compiler said that ANSI guaranteed signed chars by default. Thanx for telling me of my error. In fact the documentation says that the compiler switched defaults to conform with ANSI. (My compiler is turbo C).
ark@alice.UUCP (Andrew Koenig) (06/27/89)
In article <2379@uwovax.uwo.ca>, 2014_5001@uwovax.uwo.ca writes: > Howvwer in real C (ANSI C) chars are guaranteed signed. I don't think so, unless you declare them as `signed char' -- --Andrew Koenig ark@europa.att.com
henry@utzoo.uucp (Henry Spencer) (06/27/89)
In article <2379@uwovax.uwo.ca> 2014_5001@uwovax.uwo.ca writes: >Howvwer in real C (ANSI C) chars are guaranteed signed. Please cite chapter and verse when you make such a remarkable statement. ANSI C has three types of character: "signed char", guaranteed signed; "unsigned char", guaranteed unsigned; and "char", WHICH IS EITHER SIGNED OR UNSIGNED AS THE IMPLEMENTATION PLEASES, just like it has always been. -- NASA is to spaceflight as the | Henry Spencer at U of Toronto Zoology US government is to freedom. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
reggie@dinsdale.nm.paradyne.com (George W. Leach) (06/28/89)
In article <18291@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >(Personally, I prefer the terms `Classic C' and `New C', a la the change >to Coca-Cola.) Careful. Remember that New Coke didn't last too long...... George W. Leach AT&T Paradyne (uunet|att)!pdn!reggie Mail stop LG-133 Phone: 1-813-530-2376 P.O. Box 2826 FAX: 1-813-530-8224 Largo, FL USA 34649-2826
scjones@sdrc.UUCP (Larry Jones) (06/28/89)
In article <2379@uwovax.uwo.ca>, 2014_5001@uwovax.uwo.ca writes: > Howvwer in real C (ANSI C) chars are guaranteed signed. ? I can't say anything about "real" C, but in ANSI C, chars are most definitely NOT guaranteed to be signed. "signed char"s are signed, "unsigned char"s are unsigned, and "char"s may be either. ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@SDRC.UU.NET 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 "You can't get a body like mine in a bottle -- unless you push REAL HARD." - Judy Tenuta / Dr. Pepper
gwyn@smoke.BRL.MIL (Doug Gwyn) (06/28/89)
In article <18291@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >(Personally, I prefer the terms `Classic C' and `New C', a la the change >to Coca-Cola.) Unfortunately, "Classic C" was fuzzily defined; it seemed to mean different things to different implementors, which is one reason that X3J11 spent several years refining the definition. Many people involved with C standardization are using the term "Standard C" for the language+library specified by X3J11. That takes into account the possibility of an ISO standard as well as an ANSI standard, also FIPS etc. Every effort is being made to prevent a multiplicity of differing C standards. At the Seattle meeting, ISO WG14 agreed to propose the same standard as X3J11; thus so far the term "Standard C" is unambiguous. Even though it hasn't yet made it through any official approval cycle, the Standard is stable and well known, so it can serve perfectly well as a practical Standard while the bureaucracy moves ponderously forward.
ftw@masscomp.UUCP (Farrell Woods) (07/02/89)
In article <2379@uwovax.uwo.ca> 2014_5001@uwovax.uwo.ca writes: >Howvwer in real C (ANSI C) chars are guaranteed signed. Only if you say "signed char". Unadorned char may be either signed or unsigned. -- Farrell T. Woods Voice: (508) 392-2471 Concurrent Computer Corporation Domain: ftw@westford.ccur.com 1 Technology Way uucp: {backbones}!masscomp!ftw Westford, MA 01886 "I can't drive...fifty-five!"