Date: Wed, 6 Oct 2021 18:34:15 +0200
Il 06/10/21 18:03, Phil Bouchard via Std-Proposals ha scritto:
> 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
>
> }
>
This specific syntax is taken by designated initializers. In
void A::foo()
{
B b{ .var = 42 };
};
are you initializing the `var` data member of B via aggregate init, or
assigning 42 to this->var and then using some other form of init for B?
That having been said, I'd hardly claim that this is a "major" problem
deserving its own syntax; renaming the parameter or the member variables
following proper code conventions sounds like a better idea anyways.
My 2 c,
> 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
>
> }
>
This specific syntax is taken by designated initializers. In
void A::foo()
{
B b{ .var = 42 };
};
are you initializing the `var` data member of B via aggregate init, or
assigning 42 to this->var and then using some other form of init for B?
That having been said, I'd hardly claim that this is a "major" problem
deserving its own syntax; renaming the parameter or the member variables
following proper code conventions sounds like a better idea anyways.
My 2 c,
-- Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
Received on 2021-10-06 11:34:27