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
View all comments
Show parent comment
-2
u/azswcowboy Mar 21 '26 edited Mar 21 '26
Fair, I didn’t check the standard, but not all compilers supported it because we had to do otherwise. CE doesn’t have gcc 2.95 or Solaris compilers and now that I think about it my memory is about pre 98 ecosystem.