Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!mailrus!ames!purdue!mentor.cc.purdue.edu!pur-ee!pur-phy!sho From: sho@pur-phy (Sho Kuwamoto) Newsgroups: comp.lang.c Subject: Re: sizeof (integral types) Message-ID: <2199@pur-phy> Date: 26 Apr 89 21:08:17 GMT References: <10044@smoke.BRL.MIL> <7.UUL1.3#5109@pantor.UUCP> <5387@xyzzy.UUCP> Reply-To: sho@newton.physics.purdue.edu.UUCP (Sho Kuwamoto) Organization: Purdue Univ. Physics Dept., W. Lafayette, IN Lines: 30 In article <5387@xyzzy.UUCP> meissner@tiktok.UUCP (Michael Meissner) writes: >* minimum value for an object of type int >INT_MIN -32767 >* maximum value for an object of type int >INT_MAX 32767 The above was given only as an example of how an ANSI compliant C could define these values, but why not make INT_MIN -32768? This is more than a knee jerk reaction against pascal. I remember some example program or something written for the mac in pascal. Some routine in the ROMs needed a 16 bit value, and the worst of it was that the program in question needed to pass it 0xf000. Because of Pascal's strong typechecking, this value was not allowed, and they had to put in some ugly hack. Now I understand that you could always use an unsigned int for something like this, but it seems un c-like to make 0xf000 somehow an illegal value. This is a contrived example, but suppose I was writing something which scanned characters, and checked to see if the high bit was set. Would it be inelegant to say something like: signed char c; [...] if(c<0){ [...] In either case, I want to be able to access all possible values with my bits, regardless of whether or not my variable is signed. -Sho