Date: Thu, 07 Oct 2021 09:38:42 +0100
Hi,Also my 5 cents contrib.I prefer to use "m_" for member variables as a naming convention, and to keep them at the top of the struct declaration.struct B{ int m_var;};Using this method you can quickly search for member variables in your prefered IDE.(extensively used in GUI especially in Qt world):)NadirSent from my Galaxy
-------- Original message --------From: Nikolay Mihaylov via Std-Proposals <std-proposals_at_[hidden]> Date: 10/7/21 9:06 AM (GMT+01:00) To: Std-Proposals <std-proposals_at_[hidden]> Cc: Nikolay Mihaylov <nmmm_at_[hidden]> Subject: Re: [std-proposals] "this->" -> "." alias My 5 cents about the thing nobody mentions.Although many programming languages uses underscore for private members, in C++ and probably in C, you are not allow to do anything with front underscore. Yes, compiler will accept it and it will be compiled,but these are reserved for system library implementation.So:class A{ int _a; int _b;public:// ...}this is not allowed.I personally use this:class A{ int a_; int b_;public:// ...}RegardsOn Thu, Oct 7, 2021 at 10:56 AM Gašper Ažman via Std-Proposals <std-proposals_at_[hidden]> wrote:As a note, deducing this is in c++23.On Thu, Oct 7, 2021, 04:16 Phil Bouchard via Std-Proposals <std-proposals_at_[hidden]> wrote:
On 10/6/21 3:56 PM, Keenan Horrigan via
Std-Proposals wrote:
I would think that the "Deducing this"
paper would supersede this idea, as methods with "object
parameters" are currently proposed to disallow using the this
keyword or implicitly looked up member variables within them, so
a "var" parameter would be unambiguously the parameter and you'd
have to access the member variable through something like
"self.var".
Oh yeah I remember that proposal. I was suggesting an alternative
but the conversation died in the egg for some reason and I never
followed up:
https://lists.isocpp.org/std-proposals/2020/03/1215.php
Same idea at its root but different syntax.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, October 6th, 2021 at 1:26 PM, Phil Bouchard via
Std-Proposals <std-proposals_at_[hidden]> wrote:
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]>
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,
--
Phil
Bouchard
CTO
T: (819)
328-4743
E: phil_at_[hidden] | www.fornux.com
1188 rue
Saint-Louis
| Gatineau
(Qc), J8T 2L8 Canada
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]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
--
Phil
Bouchard
CTO
T: (819)
328-4743
E: phil_at_fornux.com | www.fornux.com
1188 rue Saint-Louis | Gatineau (Qc), J8T 2L8
Canada
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.
--
Phil Bouchard
CTO
T:
(819) 328-4743
E:
phil_at_[hidden] | www.fornux.com
1188 rue Saint-Louis | Gatineau (Qc), J8T 2L8 Canada
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.
-------- Original message --------From: Nikolay Mihaylov via Std-Proposals <std-proposals_at_[hidden]> Date: 10/7/21 9:06 AM (GMT+01:00) To: Std-Proposals <std-proposals_at_[hidden]> Cc: Nikolay Mihaylov <nmmm_at_[hidden]> Subject: Re: [std-proposals] "this->" -> "." alias My 5 cents about the thing nobody mentions.Although many programming languages uses underscore for private members, in C++ and probably in C, you are not allow to do anything with front underscore. Yes, compiler will accept it and it will be compiled,but these are reserved for system library implementation.So:class A{ int _a; int _b;public:// ...}this is not allowed.I personally use this:class A{ int a_; int b_;public:// ...}RegardsOn Thu, Oct 7, 2021 at 10:56 AM Gašper Ažman via Std-Proposals <std-proposals_at_[hidden]> wrote:As a note, deducing this is in c++23.On Thu, Oct 7, 2021, 04:16 Phil Bouchard via Std-Proposals <std-proposals_at_[hidden]> wrote:
On 10/6/21 3:56 PM, Keenan Horrigan via
Std-Proposals wrote:
I would think that the "Deducing this"
paper would supersede this idea, as methods with "object
parameters" are currently proposed to disallow using the this
keyword or implicitly looked up member variables within them, so
a "var" parameter would be unambiguously the parameter and you'd
have to access the member variable through something like
"self.var".
Oh yeah I remember that proposal. I was suggesting an alternative
but the conversation died in the egg for some reason and I never
followed up:
https://lists.isocpp.org/std-proposals/2020/03/1215.php
Same idea at its root but different syntax.
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, October 6th, 2021 at 1:26 PM, Phil Bouchard via
Std-Proposals <std-proposals_at_[hidden]> wrote:
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]>
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,
--
Phil
Bouchard
CTO
T: (819)
328-4743
E: phil_at_[hidden] | www.fornux.com
1188 rue
Saint-Louis
| Gatineau
(Qc), J8T 2L8 Canada
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]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
--
Phil
Bouchard
CTO
T: (819)
328-4743
E: phil_at_fornux.com | www.fornux.com
1188 rue Saint-Louis | Gatineau (Qc), J8T 2L8
Canada
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.
--
Phil Bouchard
CTO
T:
(819) 328-4743
E:
phil_at_[hidden] | www.fornux.com
1188 rue Saint-Louis | Gatineau (Qc), J8T 2L8 Canada
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] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2021-10-07 03:38:51