Re: allocation alignment for global and local variables.



gamja wrote:
Hi all.

I know that some padding bits are inserted between data members of a
structure. Is this rule also applied for the variables on local stack
or global??? For example, in following code dumps...
There isn't a rule.
It's up to the implementation.

------------
struct foo foo1;
...
struct bar bar1;
...
char byte;
int dword;

int main(void)
{
}
--------------
Is it allowed to expect that each start address of foo1, bar1, byte and
dword are aligned 4bytes?
No.

(well, noone prohibits you from expecting whatever you want ;-)

Does the C99 specification state any rules related with this problem?
No.
This is no problem.
.