Why some people use "this->" when there is no need? |
I can only speak for myself, but why I use
this-> is for the same/similar reason(s) why I do NOT have
using namespace std;
littering my code. Using the
std:: prefix and
this-> "self"-documents my code.
I also use custom namespaces as much as possible when I want to use a name already used by the C++ standard or another commonly used library such as Boost.
I try as much as possible to use long-form descriptive names when creating variables, saving terse 1-3 letter names for loop counters.
I'm hot/cold on encoding variables, class or global, with prefixes. Globals more likely than class member data.
I mostly use comments as placeholders for code I have yet to write, or as reminders for testing of existing code. Rarely do I use them to document already written and properly working code.
Ultimately much of my code is For My Eyes Only. If'n I were working with others, and there was an established coding style, I'd bend and use what is already set.