Type of expression sizeof(x)
Douglas W O'neal
doug at jhunix.HCF.JHU.EDU
Fri Sep 22 21:56:52 AEST 1989
In article <256 at servio.UUCP> penneyj at servio.UUCP (D. Jason Penney) writes:
> [ example deleted ]
>It seems that the sizeof() is promoting the expression to be
>unsigned. By the way, changing 3 to 3L does NOT make the problem disappear.
> [...]
>Our conversation with DEC re this bug was extremely unhelpful. They claim that
>the return type of a sizeof() expression is system-dependent.
Quoting from _The C Programming language_, 2nd edition, page 135:
"Strictly, sizeof produces an unsigned integer value whose type, size_t,
is defined in the header <stddef.h>."
>From this statement, I do not think that in is unreasonable for DEC
to make sizeof of type unsigned since they are required for ANSI C
to return a unsigned int.
--
Doug O'Neal doug at jhuvms.hcf.jhu.edu
Homewood Academic Computing doug at jhuvms.bitnet
Johns Hopkins University mimsy!aplcen!jhunix!doug
More information about the Comp.lang.c
mailing list