<div dir="ltr">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 class="im">#include <iostream><br></div><div class="im">
<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 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>