GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Problem with hiding (shadowing) variables
Re: Hiding variables... take them seriously!!! [message #9470 is a reply to message #9468] Tue, 29 September 2009 15:24 Go to previous messageGo to previous message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hallo Sebastian,

it good that you give this example! in fact what you have here is also some kind of violation against the C++ standard,

Here's what the C++ Standard says (17.4.3.1.2):

Quote:

"Each name that contains a double underscore (_ _) or begins with an underscore followed by an uppercase letter is reserved to the implementation"


However, some compilers allow this, because for all it knows your code could be
part of the OS or libc that has the legitimate right to use such identifiers.
But technically it's actually undefined behavior, the reason being that you
may tread on a reserved name.

In our case here the compiler simply ignore your underscore and then you get this warning. So it is not completely meaningless and you can look yourself that many books and forums advice not use the underscore in a variable name!

regards

Mohammad
 
Read Message
Read Message icon4.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GENFIT restructuring in development branch is done - merge needed
Next Topic: Association Tools committed
Goto Forum:
  


Current Time: Thu Apr 25 16:17:18 CEST 2024

Total time taken to generate the page: 0.01129 seconds