Home » PANDA » PandaRoot » General » Problem with hiding (shadowing) variables
Re: Hiding variables... take them seriously!!! [message #9459 is a reply to message #9456] |
Tue, 29 September 2009 12:05 |
StefanoSpataro
Messages: 2736 Registered: June 2005 Location: Torino
|
first-grade participant |
From: *to.infn.it
|
|
If you know what you are doing, then probably all those warnings are useless.
But when you call a data member in your class "x", and then inside your class you define in each function new variables called "x", then are you really sure that you are always using the proper "x"? If you forget one time to define again this x, the compiler does not help you and you will use the wrong one.
One case is inside emc package, where the code was simply taken from the other framework, and there are many of these warnings. Using our coding rules, such as calling the data members fX as decided ages ago, one can avoid those warnings.
Therefore, I think these warnings are a good excuse to recheck the code being sure on whay it is really doing.
|
|
|
Goto Forum:
Current Time: Thu Dec 12 21:32:27 CET 2024
Total time taken to generate the page: 0.00813 seconds
|