lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] wrong statement in lwip wiki page about structure packi


From: Simon Goldschmidt
Subject: Re: [lwip-users] wrong statement in lwip wiki page about structure packing
Date: Wed, 29 Aug 2012 12:44:59 +0200

jblackarty wrote:
> Structure alignment and packing of internal members are different
> things.

I'm not so sure about that (in the lwIP context, that is).

> Author of those phrase was wrong in last words about packing.
> Structure members may be padded relatively to each other in general case.
> This is what I talking about. I don't know what means "packing" with
> respect to whole structure but I'm sure each member must be packed
> separately.

So if you don't know that, how can you be sure that "Structure alignment and 
packing of internal members are different things"?

I think that PACK_STRUCT_STRUCT and PACK_STRUCT_FIELD are just two different 
macros for different compilers: one compiler may need a struct marked as packed 
while another compiler may need the fields marked as packed (or both) while yet 
another compiler uses pragmas (and thus has to declare the 2 include files).

I know that there is a difference between structure packing and being able to 
access unaligned data. lwIP mixes up these two and relies on the fact that most 
compilers (all I know, at least) can access members of packed struct that are 
unaligned.


Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]