Closed ghost closed 4 years ago
It seems like this example violates http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es12-do-not-reuse-names-in-nested-scopes . Is there an example that doesn't?
Aha, there it is It looks es12 covers this problem Thank you! I will check a bit more and close this issue
Hello,
Why don't we add some guideline for not using
extern
local variables?I'm not sure but I found that some different behavior between compilers
While I was just checking which linkages are granted to
extern
local variablesfor instance if I tested below code
as you see in the comments variable
var
s have different linkagesthe result is
I can see from the result that if there are more than two nested blocks
g++ just grants external linkages to variables
I could find a related phrase in the standard
but it is still unclear to me because its behavior is different by compilers
(https://eel.is/c++draft/basic.link#6)
I don't know that which compilers are conforming the standard well
and do you think that it is helpful to add some guide about it?