Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-unix!ctnews!pyramid!prls!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: comp.lang.c Subject: Re: Why should "sizeof" be unsigned? Message-ID: <2231@mmintl.UUCP> Date: Wed, 1-Jul-87 17:56:49 EDT Article-I.D.: mmintl.2231 Posted: Wed Jul 1 17:56:49 1987 Date-Received: Sat, 4-Jul-87 13:19:59 EDT References: <1748@plus5.UUCP> <586@haddock.UUCP> <1750@plus5.UUCP> <1557@sfsup.UUCP> <22242@sun.uucp> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT. Lines: 21 In article <22242@sun.uucp> guy%gorodish@Sun.COM (Guy Harris) writes: |The complaint being made is that having "sizeof" yield a value of |type "unsigned int", rather than "int", precludes having -1 as an |out-of-band value for routines that normally take a "sizeof". Saying |"'sizeof' yields a value of type 'unsigned int', so you can't use -1 |as an out-of-band value anyway" doesn't argue that the complaint is |invalid, it just points out why the complaint is being made in the |first place! (I have no strong opinion either way on this. I merely |point out that "the type of 'sizeof' is 'unsigned int'" is not, by |itself, a valid argument against the proposition that it should be |"int".) The point nobody seemed to notice is that on some machines, sizeof *has* to be unsigned -- "int" isn't big enough. Thus code which uses -1 as an out- of-band value in an integer holding a sizeof result is not portable. A standardization which causes non-portable code to no longer compile is a good thing. -- Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Ashton-Tate 52 Oakland Ave North E. Hartford, CT 06108