On Wed, 31 May 2006, Emil Kondayan wrote:
Can someone tell me why "ip_hl" and "ip_v" are of type "u_int" when the
structure is packed and they only fill a byte?
Because ip.h is mostly written in C (!= Gnu C) and bit-fields cannot have
type u_char in C. From an old draft of C99 (n689.txt):
%
On Jun 1, 2006, at 12:57 AM, Emil Kondayan wrote:
Can someone tell me why "ip_hl" and "ip_v" are of type "u_int" when
the
structure is packed and they only fill a byte?
Well, that struct definition is relying on the compiler to squeeze
the bitfields into the smallest space required. Some p
At Wed, 31 May 2006 21:57:03 -0700,
Emil Kondayan wrote:
>
> Can someone tell me why "ip_hl" and "ip_v" are of type "u_int" when the
> structure is packed and they only fill a byte?
u_int means unsigned int and they only fill a byte because 4 + 4 = 8
bits (a byte) (I'm not going into the "Why is