Path: utzoo!attcan!uunet!ingr!crossgl From: crossgl@ingr.UUCP (Gordon Cross) Newsgroups: comp.lang.c Subject: Re: Why unsigned chars not default? Summary: treatment of "char" is implementation defined Message-ID: <2723@ingr.UUCP> Date: 24 Oct 88 21:42:30 GMT Organization: Intergraph Corp. Huntsville, Al Lines: 21 In article <9563@pur-ee.UUCP>, mendozag@pur-ee.UUCP (Grado) writes: > > However, much to his dismay, other compilers (LSC, MSC, and Unix) > require him to declare as unsigned char the I/O buffer (which he > also uses for arithmetic operations) else the chars are negative > numbers when the their contents represents value > 127. (He does > a lot of arithmetic with characters representing integers). > The proposed ANSI C standard states (I am quoting directly from the document): " An object declared as a character (char) is large enough to store any member of the required source charcater set [ .. ]. If such a character is stored in a char object, its value is guaranteed to be non-negative. If other quantities are stored in a char object, the behavior is implementation defined: the values are treated as either signed or non-negative integers." Basically, this allows each complier writer to explore his whims. Hope it helps! Gordon Cross