Subject: sizeof ....
To: Roland McGrath <>
From: Richard Wackerbarth <>
List: current-users
Date: 11/01/1994 15:50:06
In response to
>   > Probably it should use 4 instead of sizeof(u_long), in fact.
>   sizeof(u_int32_t) rather than 4, even...  8-)

Roland McGrath <> writes

>Perhaps we need to define a new constant SIZE_IN_BYTES_OF_A_FOUR_BYTE_QUANTITY.
>That seems safest.

Not really .....
(u_int32_t) is a very descriptive definition of the data stored.
However, I might have some reason to implement a tagged scheme that has
some bits in addition to the data bits (An old implementation of LISP comes
to mind). This would require additional storage.
And then there is the question of the meaning of "sizeof". You just assume
that it means bytes. It really means addressable allocation units. These
might not be bytes, either.

Therefore, IMHO, "sizeof(u_int32_t)" is the proper designation.