On 18/10/2019 02:37, Kevin Kofler wrote:
Ville Voutilainen wrote:
Since we are about to do a major version upgrade, should be stop being
a special snowflake in the C++ world and start attaching pointer-stars
and reference-ampersands to the type instead of to the variable?
No, because it is syntactically not a part of the type, as evidenced by the
int *x, y; example that others have already pointed out. Semantically, it
is, but the semantics are only computed after doing the syntactic parsing,
so the whitespace should preferentially match the syntax.
And I consider the idea of banning comma declarations to work around this
issue to be nothing more than a workaround for poor notation not matching
the syntax of the language.
Apparently there are already good reasons not to do that even before
considering T* foo vs T *foo, as it has been banned by the style already:
https://wiki.qt.io/Qt_Coding_Style#Declaring_variables
So this potential change will not cause issues in this area.
Personally, I have always preferred the T* foo (and T& bar) style, as to
me the pointer-ness or reference-ness *is* part of the type of the
variable. It is evident in how big the type is, in how typeid identifies
the type of the variable, in type deduction...
Anyway, I doubt it's worth changing it.
André
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development