sizeof a struc field

T. William Wells bill at twwells.com
Sat Oct 21 05:28:27 AEST 1989


In article <1234 at crdos1.crd.ge.COM> davidsen at crdos1.UUCP (bill davidsen) writes:
: Here's what the standard says (3.3.3.4):
:
: The result is an integer constant.

:                                                          I also really
: wonder why sizeof doesn't return "unsigned int" but I suspect i wouldn't
: like the answer.

Watch that wording!

The quoted material says that sizeof results in an integer
constant, not that it results in a constant of type int.

Sizeof returns something of type size_t, which must be unsigned.
Unsigned of *some* type. It might be unsigned short :-) but I
suspect that the intent was to permit unsigned long.

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com



More information about the Comp.lang.c mailing list