On Mon, Nov 15, 2010 at 03:25:54PM +0100, Arnd Bergmann wrote: > On Friday 12 November 2010, Russell King - ARM Linux wrote: > > It is a bad idea to describe device registers using C structures, and > > especially enums. > > > > The only thing C guarantees about structure layout is that the elements > > are arranged in the same order which you specify them in your definition. > > It doesn't make any guarantees about placement of those elements within > > the structure. > > Right, I got carried away when seeing the macro overload. My example > would work on a given architecture since the ABI is not changing, but > we should of course not advocate nonportable code. That is a mistake. You can't rely on architectures not changing their ABIs. See ARM as an example where an ABI change has already happened. We actually have two ABIs at present - one ('native ARM') where enums are sized according to the size of their values, and the Linux one where we guarantee that enums are always 'int'. We also have differing struct layouts for EABI vs OABI on ARM. So really the assumption that ABIs never change in incompatible ways is a false one. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html