Code style: this->m_member
vs just m_member
#1008
Replies: 5 comments 2 replies
-
Since we have lots and lots of |
Beta Was this translation helpful? Give feedback.
-
So the issue here is that using the variable without de-referencing That is, unless I've really misunderstood something. |
Beta Was this translation helpful? Give feedback.
-
I'm afraid godbolt seems to disagree with you on this matter. |
Beta Was this translation helpful? Give feedback.
-
This bit from cppreference is interesting though:
To translate the standardese into a human-readable form, C++ template parsing is hopelessly broken and because of that you may need seemingly superfluous this qualifiers in certain (obviously unspecified, otherwise it would spoil all the fun of discovering it yourself) template contexts. |
Beta Was this translation helpful? Give feedback.
-
In that case I guess it would make the most sense to use explicit |
Beta Was this translation helpful? Give feedback.
-
The eternal struggle.
I notices @stephenswat recently added some code which uses the style
this->m_member
to access member variables and methods. I don't think we use this anywhere else, and rely on the prefixm_X
to mark members relative to local variables. In a few cases we do use it to disambiguate.Do we want to include this in our code guidelines in some form? Encourage / discourage it?
This doesn't have to be absolutely consistent, it's just something I thought we should think about.
Beta Was this translation helpful? Give feedback.
All reactions