Davide Schiera wrote:

> The structures are used to wrap the header of a 802.11 packet.
> The base format of these structures are
>       UCHAR   fc[2];
>       UCHAR   dur[2];
>       UCHAR   addr1[AIRPDCAP_MAC_LEN];        // addr1[6]
>       UCHAR   addr2[AIRPDCAP_MAC_LEN];
>       UCHAR   addr3[AIRPDCAP_MAC_LEN];
>       UCHAR   seq[2];
> If any compiler align each field at the desired position (fc:0, dur:2,
> addr1:4, ...) the #pragma pack is definitely unneeded. If not, there is
> another way to do the same thing?

If the alignment were at the desired position, it would be because the 
compiler added extra padding between the fields.  Alignment is 
implementation-defined in C89, but I suspect the chances that a compiler 
would add padding between arrays of 1-byte quantities are less than the 
chances that a compiler would support "#pragma pack" in that particular 
fashion, so leaving the "#pragma pack" out is probably safer.  (UCHAR 
expands to guchar, which is ultimately typedeffed to "unsigned char"; 
the chances that a compiler for a platform supporting Wirehark doesn't 
implement "unsigned char" as an 8-bit byte is probably also less than 
the chances that a compiler doesn't support "#pragma pack" in that 
particular fashion.)
_______________________________________________
Wireshark-dev mailing list
[email protected]
http://www.wireshark.org/mailman/listinfo/wireshark-dev

Reply via email to