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: 05 May 2004 15:15:23 +0100

On Wed, 2004-05-05 at 14:27, Timmy Brolin wrote:
> To put and end to the gcc+arm debate, I fired up my gcc arm compiler and 
> ran the example below on my gameboy advance :-)
> The offsets are as expected: 0, 1, 2.
> 
> I also ran the example in Microsoft Visual Studio 6.0
> Same result.
> 
> So now it is verified to work with at least three compilers.

Ok, carry on and let us know when you've done them all :)  Be very wary
of extending "it works on some systems" to "it works on all systems" and
also "this simple test works" to "all code that does something like the
simple test will work".

As far as I can see the pros and cons for removing the packed directives
are:

Pro:
 - makes slightly cleaner code
 
Con:
 - may not work on all compilers and platforms

No one has yet proved or disproved this con, but the possibility of it,
in my opinion, outweighs the minor issue of cleaner code.  The C
standard does not seem to provide a solid assertion that we can rely on.
(No one has been able to find that assertion anyway).  If I'm honest,
you're probably right that removing it won't cause problems, but why
change it if it isn't broken?

Quite frankly though, we have much more important things to worry about,
and this is starting to cloud other issues.  There doesn't seem to be a
consensus one way or the other, so I'm not sure of the best way to
resolve it. The macros will have to remain in the code for the Ethernet
ARP header, if I understand that correctly, so it really isn't worth
worrying about.  Leon: you seem to have been following this without
getting too involved, perhaps you could make a decision on this so we
can forget about it for the time being?

Thanks,

Kieran





reply via email to

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