Well I was asking here on purpose because I figured out that it was the best thing to do, or in better terms, It was something that could have more chances to be explained by some compiler-guy rather than a programmer.<br>
<br>I'm not gonna use this in real code, it's just to test some business logic about how things works, notice that since now, nobody has offered a real explanation for this.<br><br><div class="gmail_quote">2013/7/30 Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im">On 30 July 2013 09:08, David Chisnall <span dir="ltr"><<a href="mailto:David.Chisnall@cl.cam.ac.uk" target="_blank">David.Chisnall@cl.cam.ac.uk</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>#include <iostream><br></div><div>

<br>
int main() {<br>
  {<br>
    extern "C" int a = 42;<br>
    { std::cout << a << "\n"; }<br>
  }<br>
  return (0);<br>
}<br>
<br>
</div>This also fails to compile.  I'm not sure what you'd expect the semantics to be.  The variable a has automatic storage, and so a linkage specifier makes no sense in this context.<br></blockquote><div></div>

</div><br></div></div><div class="gmail_extra">This code fails to compile because: "variable declarations with the extern specifier at block scope refer to declarations that are members of an enclosing namespace, but they do not introduce new names into that scope." 3.3.2-10.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">Ajit, your example contains several invalid C/C++ semantics, I'm really not sure how you got this code, or why you want to change the linkage semantics of a local variable.</div>

<div><br></div><div>Honestly, you'd have more luck on dissecting the C++ standard at comp.lang.c++, not here.</div><div><br></div><div>cheers,</div><div>--renato</div></div>
</blockquote></div><br>