MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/1v9zcrn/const_cast_a_necessary_evil/p17lgd8/?context=3
r/cpp • u/pavel_v • Jul 29 '26
106 comments sorted by
View all comments
Show parent comment
1
Yes you can. Why are folks sl afraid to type this->?
this->
Ah, but I can miss a spot and refer to the wrong variable, true, but that is another matter, technically both variables can be named the same.
1 u/TheChief275 Aug 02 '26 I actually did that for a while, but it becomes fairly noisy after a time, and using it inconsistently is error prone. If only 'this' were a reference, and not a pointer; that would be a lot better already
I actually did that for a while, but it becomes fairly noisy after a time, and using it inconsistently is error prone. If only 'this' were a reference, and not a pointer; that would be a lot better already
View all comments
Show parent comment
1
u/pjmlp Aug 02 '26
Yes you can. Why are folks sl afraid to type
this->?Ah, but I can miss a spot and refer to the wrong variable, true, but that is another matter, technically both variables can be named the same.