Ethereal-dev: Re: [ethereal-dev] ANSI bitfields

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Gilbert Ramirez Jr." <gram@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 1 Feb 1999 15:42:25 -0600 (CST)
As Laurent Deniel said:
> 
> I think this is not a good solution. memcpy'ing the whole struct is 
> preferable to copying each field. We have just to correctly define a
> particular structure. For instance, if you define the igmp structure in
> such a way:
> {
> guint_8  igmp_type;
> guint_8  igmp_code;
> guint_16 igmp_cksum;
> guint_32 igmp_gaddr;
> }
> I don't know any modern C compiler that will do the wrong thing about
> alignment. We have just to define structures in a compiler-independent
> way and to handle any further endianness problem in the code itself rather
> than in the structure definition.

that sounds like a good thing to do, if there are no alignment problems.

--gilbert

-- 
Gilbert Ramirez                Voice:  +1 210 358 4032
Technical Services             Fax:    +1 210 358 1122
University Health System       San Antonio, Texas, USA