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

howto use __packed ?

hi all,
         i was reading an FAQ on ARM. Which i have pasted below.

------------------------------------------------------------------------------------------------------------------------- Thus if you wish to define a pointer to a word that can be at any address (i.e. that can be at a non-natural alignment) then you must specify this using the __packed qualifier when defining the pointer:

 __packed int *pi; // pointer to unaligned int


i have used __attribute(packed)) on structure's before as
struct temp
    int x;
    char y;
    int z;
} __attribute((packed));

and it seemed to work , as per the lines in the FAQ
i tried : __packed int *pi;  gcc complains saying __packed undeclared .

where did i go wrong ? does gcc support such use of __packed on non structures and non-union's ??
and has somebody tried this syntax ?

thanks for your time.


Reply to: