r/cpp • • Mar 20 '26

Draft idea: constructor member designators

I’ve been experimenting with a small idea to make constructor initializer lists a bit clearer and less error‑prone. The idea actually came from a dilemma I had when trying to settle on naming conventions for member variables. Prefixes like m_ or _name help avoid shadowing, but they also feel like a workaround for something the language could express more directly.

I wrote a short draft exploring “constructor member designators” - a `.member` syntax for constructor initialization.

https://github.com/richardcervinka/cpp-constructor-member-designators

This is just an experiment, but maybe someone will find it interesting.

0 Upvotes

16 comments sorted by

View all comments

Show parent comment

2

u/aocregacc Mar 20 '26

It sounds to me like OP was rationalizing all these coding standards and naming conventions by coming up with this technical reason for them.
I don't think I've seen this misconception before so I was wondering how common it is.

I guess they could just be talking about ambiguity to a human reader and went a bit over the top with the wording.