hi
i am using sdcc for last 5 months, but got this problem with union.
is union working properly with sdcc 2.6 and sdcc sdcc-20061129-4491 ???
i am giving some c code and the corresponding generated assembly code...... its compiled in sdcc 2.6
Logged In: YES user_id=888171 Originator: NO
Hi,
There is no bug here. All three union members start at _real_data in the asm. Maybe you wanted something like:
union ab { unsigned int ab_main; unsigned char ab_first[2]; };
or
union ab { unsigned int ab_main; struct { unsigned char ab_first; unsigned char ab_second; } bytes; };
In the latter bytes is optional for SDCC but not for all C compilers.
Maarten
Log in to post a comment.
Logged In: YES
user_id=888171
Originator: NO
Hi,
There is no bug here. All three union members start at _real_data in the asm.
Maybe you wanted something like:
union ab
{
unsigned int ab_main;
unsigned char ab_first[2];
};
or
union ab
{
unsigned int ab_main;
struct
{
unsigned char ab_first;
unsigned char ab_second;
} bytes;
};
In the latter bytes is optional for SDCC but not for all C compilers.
Maarten