Re: Why error "variable previously declared ‘static’ redeclared ‘extern’"?

Jonathan Wakely jwakely.gcc@gmail.com
Mon Jul 7 14:52:00 GMT 2014


On 7 July 2014 15:19, Alec Teal wrote:
> All wrong:
>
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
>
> Top of page 144.

I don't think that page is relevant.

Try section 6.2.2 paragraphs 4 and 7.

The code has undefined behaviour, which means the compiler can issue a
diagnostic, or ignore it, or generate a binary with unexpected
results.

N.B. in C++ the code is not undefined, instead there are three
different objects called i5 with internal linkage, no linkage and
external linkage respectively (see the example in section 3.5 paragaph
6 in the C++ standard).



More information about the Gcc-help mailing list