This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Jonathan Wakely, I have a confusion about structure size calculation. I have tried to compared structure size result with gcc version 4.7.2 20121109 (Red Hat 4.7.2-8) generates code for x86 machine and cross compiler with gcc version 4.3.4 generate code for custom processor. struct sample { short int s; }a; sizeof(a) showing 2 bytes with x86 gcc and 4 bytes with cross compiler. struct sample { int i; short int s; }a; sizeof(a) showing 8 bytes with x86 gcc and 8 bytes with cross compiler. When compiler will add hole at end of the structure ? why cross compiler trying to make structure size multiple of 4 ? Thanks, Siva prasad On 05/19/2014 07:14 PM, Jonathan Wakely wrote:
On 19 May 2014 13:28, Sivaprasad wrote:Hi Jonathan Wakely, Thanks for quick reply. Structure is included from same header file,So there is no difference in structure.You can't conclude that. Defining a macro before including the header could alter the definition of the structure. A #pragma to turn on packed structs that comes before the header could alter the definition. You need to compare the preprocessed output for the two files.How to get information related to alignments from preprocessor output.Is there any additional options I need to give apart from "-E".You can't get that information from the preprocessor, you need to work it out by hand.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |