Dear all,
I'm struggling to understand sdcc's behaviour regarding duplicate
symbols.
This function compiles
void dummy123(void)
{
{ enum { BLA = 2 }; };
{ enum { BLA = 2 }; };
}
but this one doesn't:
void dummy123(void)
{
{ enum { BLA = 2 }; };
volatile int a = 3;
{ enum { BLA = 2 }; };
}
xyz.c:271: error 0: Duplicate symbol 'BLA', symbol IGNORED
xyz.c:269: error 177: previously defined here
Still, both BLAs' scope should be limited to their own block.
gcc accepts both versions.
Can anyone shed some light on this?
Thanks for your help,
Martin
BTW: The whole point of this exercise is to use a compile-time assert macro
such as
#define ct_assert(e) { enum { ct_assert_value = 1/(!!(e)) }; }
and allow this to be used before and after variable declarations.
|