What breaks? (was Re: 64 bit longs?)

David Tanguay datangua at watmath.waterloo.edu
Tue Jan 22 22:19:03 AEST 1991


In article <1991Jan21.190008.1291 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
>The TCP header, being part of a network protocol, is defined down to the bit
>independently of any specific machine.  Its address fields, for example,
>are 32 bits.  Not 31, not 33, and certainly not 36.  32 and only 32.
>A machine with a sufficiently weird structure may have trouble declaring
>a TCP header using a C struct.

32 bits is the size of the transmitted info. Why does the C structure
representing that header have to match it exactly? Only the routines
that read and write the header should have to care about whether the
C structure matches the transmitted packet bit for bit, and adjust
accordingly.  A bitfield might be required to get proper arithmetic on
the field.
-- 
David Tanguay            Software Development Group, University of Waterloo



More information about the Comp.lang.c mailing list