AnsweredAssumed Answered

aligned attribute issue

Question asked by cencong su on Apr 19, 2016
Latest reply on Apr 26, 2016 by cencong su


From the MCU Kinetis Builds Reference Manual, I see:

 

 

I have a code like:

 

struct ss

{

  char a;

  int b __attribute__ ((aligned(1)));

};

 

I compile it with codewarrior 10.6 and use sizeof() to check the size of this struct, And I found the size is 8, and then I check the address of a and b, found their address still align at 4.

 

But I mean to make b align at 1, so the size of the struct shall be 5.

 

Did I misunderstand something or I miss something?

Outcomes