Re: [PATCH] zd1211rw: Removed unneeded packed attributes
From: Ulrich Kunitz <hidden>
Date: 2006-09-01 19:41:27
From: Ulrich Kunitz <hidden>
Date: 2006-09-01 19:41:27
On 06-08-30 15:06 Michael Buesch wrote:
Because this clearly is a workaround for broken compilers to me, I would rather do the following: +} /* __attribute__((packed)) */; This way it's still clear to the reader, that these structs must be packed and are most likely for communication with the hardware.
I'm not so sure, whether the compilers are broken. On platforms like SPARC and IA-64 that don't support unaligned memory access the compiler has to create slow code for each packed field access. If the compiler would create fast code for accessing packed fields that are actually aligned inside the struct, it would break code that access the struct at unaligned locations. You could say these guys are relying on undefined behaviour but I would like to see how the SPARC folks would react, when gcc would break old code. Ciao, Uli -- Uli Kunitz