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

Re: Good use of pragma pack



On Thu, Jul 01, 2004 at 17:42:52 +0200, Stephane List wrote:
> Hi,
> 
> I want to write a Linux driver that will be generic for ARM and Intel.
> It will use some structures.  The driver will exchange struct with
> hardware, so data must always have the same alignment.
> 
> On ARM920, I think that we can't have a pointer on an address that is
> not multiple of 4. So what is the good pratice ?

Use the __attribute__ modifier on affected structures and elements.

[snap]
> Why not to define something like a global macro called PRAGMA or ...
> instead of all this kind of hack ?

Macro can't expand to directives. That's one of numerous reasons gcc
prefers __attribute__ -- macros can expand to __attribute__
declarations.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature