|
From: | Timmy Brolin |
Subject: | Re: [lwip-users] [PATCH] fix warning for gcc and possible unaligned access |
Date: | Tue, 25 Apr 2006 21:10:34 +0200 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
Pedro Alves wrote:
Yes, this is compiler specific. If we wanted to remove compiler dependence we would need to get rid of all __attribute__((packed)), #pragma pack, etc, as there is no standard for defining the packing/alignment of a structure.
Which is exactly why everything compiler specific (like packed attributes) in lwip is defined in arch.h Only arch.h needs to be adapted in order for lwip to work with a new compiler.
If compiler handling of unaligned accesses of packed structs is indeed compiler dependent, then what you are suggesting is that we put compiler dependent stuff in alot of files. There is a very good reason why ip_addr2 was introduced. ip_addr2 is in fact a decent solution. It is generates close optimal machine code, it is not compiler dependent, and it makes the code nice and easy to read. I would suggest that it remains unless someone comes up with a better solution which does not break compatibility with any compilers.
/Timmy Brolin
[Prev in Thread] | Current Thread | [Next in Thread] |