C++ Logo

std-proposals

Advanced search

Re: "this->" -> "." alias

From: Phil Bouchard <boost_at_[hidden]>
Date: Wed, 6 Oct 2021 13:26:19 -0400
Yeah I agree.

On 10/6/21 12:26 PM, Lee Howes wrote:
> Seems a bit much to make a language change just to allow member
> shadowing doesn't it? The following is no more typing heavy:
>
> struct A
>
> {
>
> int _var;
>
> void foo(int & var);
>
> };
>
> void A::foo(int & var)
>
> {
>
> var = 1; // changes parameter
>
> _var = 2; // changes member variable
>
> }
>
>
> On Wed, 6 Oct 2021 at 09:04, Phil Bouchard via Std-Proposals
> <std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>> wrote:
>
> Greetings,
>
>
> This is just a minor syntactic adjustment but could fix a very
> long lasted problem.
>
> Suppose you have:
>
>
> struct A
>
> {
>
> int var;
>
> void foo(int & var);
>
> };
>
>
> What I suggest is to add a prefix that could replace: "this->"
>
> void A::foo(int & var)
>
> {
>
> var = 1; // changes parameter
>
> .var = 2; // changes member variable
>
> }
>
>
> Regards,
>
> --
> Logo <https://www.fornux.com/>
> *Phil Bouchard* facebook icon
> <https://www.linkedin.com/in/phil-bouchard-5723a910/>
> CTO
> T: (819) 328-4743
> E: phil_at_[hidden] <mailto:phil_at_[hidden]>| www.fornux.com
> <http://www.fornux.com>
> 1188 rue Saint-Louis| Gatineau (Qc), J8T 2L8 Canada
>
> Banner <https://goglobalawards.org/> Le message ci-dessus, ainsi
> que les documents l'accompagnant, sont destinés uniquement aux
> personnes identifiées et peuvent contenir des informations
> privilégiées, confidentielles ou ne pouvant être divulguées. Si
> vous avez reçu ce message par erreur, veuillez le détruire.
> This communication (and/or the attachments) is intended for named
> recipients only and may contain privileged or confidential
> information which is not to be disclosed. If you received this
> communication by mistake please destroy all copies.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
-- 
Email Signature
Logo <https://www.fornux.com/>  
*Phil Bouchard*  facebook icon 
<https://www.linkedin.com/in/phil-bouchard-5723a910/>
CTO
T: (819) 328-4743
E: phil_at_[hidden]| www.fornux.com <http://www.fornux.com>
1188 rue Saint-Louis| Gatineau (Qc), J8T 2L8 Canada
Banner <https://goglobalawards.org/> Le message ci-dessus, ainsi que les 
documents l'accompagnant, sont destinés uniquement aux personnes 
identifiées et peuvent contenir des informations privilégiées, 
confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce 
message par erreur, veuillez le détruire.
This communication (and/or the attachments) is intended for named 
recipients only and may contain privileged or confidential information 
which is not to be disclosed. If you received this communication by 
mistake please destroy all copies.

Received on 2021-10-06 12:26:32