lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Struct packing/alignment problems


From: K.J. Mansley
Subject: Re: [lwip-users] Struct packing/alignment problems
Date: 26 Apr 2004 15:49:47 +0100

On Mon, 2004-04-26 at 15:02, address@hidden wrote:

> Once the structs are nicely aligned I can see no reason to use struct packing 
> compiler directives.
> But of course, we can't be 100% certain until it have been tested.

It's not just the initial alignment that is important, it's also the
layout within the structure.  Without a packed struct (I think - could
be wrong on this!) you can't guarantee that the compiler won't insert
gaps (or reorder the elements) within the struct.  Normally this isn't a
problem as the program is self-consistent, but when you try to access a
network packet using a struct you would clearly be in all sorts of
problems if there were gaps in the struct that aren't in the packet.

Kieran





reply via email to

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