|
 |
Warp wrote:
> Darren New <dne### [at] san rr com> wrote:
>> I think the same goes for putting "m" or "g" or whatever in for member or
>> global variables, etc.
>
> Why? When I started using those, my own code became much easier to
> understand to me months later. When I have code along the lines of:
>
> void Foo::doSomething()
> {
> mCounter += someValue;
> }
Oh, also, I'd write this as
this.counter += someValue;
or
Foo::Counter += someValue;
if I thought it needed disambiguation at a particular point.
I often see people do
void SetStuff(int xxx, int yyy, char* zzz)
{
mXxx = xxx;
mYyy = yyy;
mZzz = zzz;
}
where I would either do
this.xxx =xxx;
or I'd give the arguments different names
void SetStuff(int newXxx, int newYyy)
{
xxx = newXxx;
yyy = newYyy;
}
I suggested that to someone who was in the habit of putting m_ and g_ and
such on the fronts of variables, and he started naming every argument with
the word "new" on the front. I don't think he got what I was saying.
The point is to give every variable, even arguments and autos, a name that
indicates their function. Then I almost never need disambiguation.
--
Darren New, San Diego CA, USA (PST)
Eiffel - The language that lets you specify exactly
that the code does what you think it does, even if
it doesn't do what you wanted.
Post a reply to this message
|
 |