delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/08/28/08:13:56

From: terry AT aegis DOT larc DOT nasa DOT gov
Date: Sat, 28 Aug 93 11:58:24 GMT
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Thanks - structure alignment

 
 
Thanks to all that responded to my question on a work-around for
the 4-byte alignment.  removing the semicolon in
    #define PACKED __attribute__ ((packed));
didn't make any difference, gcc still crashed.  However, removing
the debug "-g" option from the compiler line did.  I now get a 
runtime "6" output from the following excerpt.  Thanks again to
one and all.
 
struct s_attach 
{ short  s;
  long   i PACKED;
};
 
void  main(void)
{ printf("%d\n",sizeof(struct s_attach));
}
 
Terry Abbott
terry AT aegis DOT larc DOT nasa DOT gov
 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019