Quote:Original post by Iftah
I prepend underscore to local member variables, because it is easy to type "_" and press control-space (auto-complete) than to remember or search or type "this->".
I usually find the reverse easier: this-> automatically calls up auto-completion. Besides, it's quite rare that I need to use a variable without knowing what its name is (during class-writing, my classes have so few variables and are written so quickly that it's difficult to forget them, and during maintenance I have to look at variable documentation anyway).
Quote:Also in some IDEs (the one I use at work...) the member variables don't have different syntax highlighting from other local variables so the underscores help highlight them.
This is true. However, I find that this-> highlights member variables even better than an initial underscore does, and it adds no unnecessary clutter, as in:
Test::Test(int x) : _x(x) // Hey, look, '_x' is a member variable !!!{}Test t;t._x = 20; // Hey, look, '_x' is a member variable !!!
Quote:abcd = 5; dfg = 4; asdgfddf = 7; ds = 9; // as opposed to abcd = 5; dfg = 4; asdfgfgf = 7; ds = 2;
Press the tab key?