struct __attribute((packed));

E. Weddington ericw@evcohs.com
Fri Apr 15 21:37:00 GMT 2005


Ralf Corsepius wrote:

>On Fri, 2005-04-15 at 10:39 -0600, E. Weddington wrote:
>
>  
>
>>What?! That whole section in the docs talks about attributes on types. 
>>If it doesn't work as described, then the docs need some serious rework.
>>    
>>
>
>>From what I see, the example for packed types doesn't even compile:
>
>(Direct cut'n'paste from
>http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Type-Attributes.html#Type-
>Attributes):
>
># cat tmp.c
>struct my_unpacked_struct
>{
>  char c;
>  int i;
>};
>
>struct my_packed_struct __attribute__ ((__packed__))
>{
>  char c;
>  int i;
>  struct my_unpacked_struct s;
>};
>
># gcc -Wall -o tmp.o -c tmp.c
>tmp.c:8: error: syntax error before '{' token
>tmp.c:12: error: syntax error before '}' token
>
># gcc --version
>gcc (GCC) 3.4.3 20050227 (Red Hat 3.4.3-22.fc3)
>
>  
>
Saved as PR 21052
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21052>

Eric



More information about the Gcc mailing list