Type of expression sizeof(x)

Scott Amspoker scott at bbxsda.UUCP
Fri Sep 22 08:31:57 AEST 1989


In article <256 at servio.UUCP> penneyj at servio.UUCP (D. Jason Penney) writes:
>I am posting this quirk to comp.lang.c because I would be VERY interested to
>hear (by e-mail, please) from anyone who thinks that this is acceptable 
>behavior.
>
>Our conversation with DEC re this bug was extremely unhelpful.  They claim that
>the return type of a sizeof() expression is system-dependent.

Somewhere along the way sizeof() became unsigned.  We had few loops
that blew up but it was easy enough to fix.  I'm not sure where we
got the notion that sizeof() was an int - but apparently a lot of
developers got the same notion.  I figured that part of the
problem was those 64K segmented, 16-bit integer processors.
In order to allow an array greater than 32k, sizeof() had to be
unsigned (or long).

I hope the ANSI draft doesn't leave this as "implementation dependent".
Some idiot implementor somewhere will make sizeof() return float.

-- 
Scott Amspoker
Basis International, Albuquerque, NM
(505) 345-5232



More information about the Comp.unix.ultrix mailing list