Mail Archives: djgpp/1998/02/07/15:45:27
In article <34DCAE69 DOT F64D9DCE AT acm DOT org> petebecker AT acm DOT org "Pete Becker" writes:
>James Hu wrote:
>>
>> This problem could have been diagnosed if you had #include'd kbd.h into
>> kbd.c.
>
>Well, no. It's perfectly legal to have an extern declaration followed by
>a static definition.
According to 6.1.2.2 it results in undefined behaviour:
"If, within a translation unit, the same identifier appears with both
internal and external linkage, the behaviour is undefined."
However as far as I can see no diagnostic is required.
>So the compiler is not required to say anything if
>you do this. I suppose it's possible that some compiler might give you a
>warning because it thinks that you may have made a mistake, but I don't
>know of one that does this.
gcc -pedantic does (so presumably DJGPP does too). The other 2 compilers
I have on this (Unix) platform do too if you put them in ANSI C mode.
--
-----------------------------------------
Lawrence Kirby | fred AT genesis DOT demon DOT co DOT uk
Wilts, England | 70734 DOT 126 AT compuserve DOT com
-----------------------------------------
- Raw text -