[PATCH] Add dive list view to main window

Alberto Mardegan mardy at users.sourceforge.net
Sun Apr 14 01:14:46 PDT 2013


On 04/11/2013 09:08 PM, Henrik Brautaset Aronsen wrote:
> "I used to use a m prefix, until someone pointed out that "C++ already has
> a standard prefix for member access: this->.
>
> So that's what I use now. That is, when there is ambiguity, I add the
> this-> prefix, but usually, no ambiguity exists, and I can just refer
> directly to the variable name.
>
> To me, that's the best of both worlds. I have a prefix I can use when I
> need it, and I'm free to leave it out whenever possible."

I also don't like too much the "m_" prefix, and I tend not to use it 
unless I have to, but there are cases where it's needed:

void Person::setAge(int age)
{
     this->age = age;
}

int Person::age() const
{
     return age;    <- Error!
}

In this case, even using "this" won't help, because the "age" token can 
refer both to the class data member and to the getter function.
I don't know a solution to this which doesn't involve renaming 
variables. :-(

Ciao,
   Alberto


More information about the subsurface mailing list