Shadowing of members
bearophile
bearophileHUGS at lycos.com
Wed Jan 9 18:57:59 PST 2013
H. S. Teoh:
> I used to write code like that too, but then I ran into some
> nasty
> ambiguity bugs, and now I'm in favor of prohibiting local
> variables
> shadowing class members. It's just *too* easy to make a
> mistake, and
> have the code write something to a local variable (which is
> lost upon
> scope exit) instead of a class member, or vice versa.
Most wise programmers use different argument names like a_,b_ and
so on, because it's very easy to create bugs in that situation.
Bye,
bearophile
More information about the Digitalmars-d
mailing list