Heater
Posts: 16296
Joined: Tue Jul 17, 2012 3:02 pm

Re: Structuring Programs

Mon Oct 09, 2017 11:25 am

It's not clear to me if the intention was to start a name with an underscore:

int _myVariable;

or use _var as some kind of type annotation:

int myVariable_var;

Crappy which ever way.

I think there are some people who use underscore to distinguish member variable names form parameter names so that you can write C++ methods like so:

Code: Select all

myClass::myMethod(int value)
{
    _value = value;
}
Otherwise you have to write:

Code: Select all

myClass::myMethod(int value)
{
    this.value = value;
}
Still I don't like it.
Memory in C++ is a leaky abstraction .

Return to “General programming discussion”