>>> Wolfgang Roemer <[EMAIL PROTECTED]> 06.10.05 16:02:37 >>>
>On Thu Oct 06, 2005 15:54, Michael Veksler wrote:
>[..]
>>>  2. I think that it will break C. As I remember, it is sometimes
>>>      legal in C (or in some dialects of C) to have conflicting
types.
>>>      You may define in one translation unit:
>>>         char var[5];
>>>      and then go on and define in a different translation unit:
>>>         char var[10];
>>>      The linker will merge both declarations and allocate at least
>>>     10 bytes for 'var' (ld's --warn-common will detect this).
>
>that is interesting: If the linker would behave that way, I wouldn't
get the 
>error because the needed 8 bytes for a double would be allocated.

I think your example had the variables initialized; this is a
difference. The linker does behave as Michael described for
uninitialized (aka common) variables; gcc's -fno-common suppresses this
behavior.

Jan

Reply via email to