-
Notifications
You must be signed in to change notification settings - Fork 264
Description
- Please do not suggest syntax changes. I accept there are hundreds of opinions and everyone will prefer something a little different. Syntax isn't the big thing, fixing semantics is -- reducing concept count, increasing toolability, are the big payoff.
This is about consistent concepts rather than just syntax.
From #574 (comment) Herb said:
I didn't see a reason to change from the familiar function-like syntax sizeof(thing) to sizeof ...? I was thinking of sizeof as a constexpr function for which ( ) would be fine.
AFAIU, a constexpr function can't take a type as an argument. E.g. you couldn't implement a function sizeof
that can be called like sizeof(int)
. So I think sizeof<T>
is more consistent. Are type parameters ever passed using function call syntax anywhere in cpp2?
Obviously, cpp1 sizeof
also takes an expression. I think often this is just a shortcut to having to write sizeof(decltype(expr))
. If that is the only reason, I would suggest it would be simpler not to have the expression parameter form at all and require using decltype
for that.
Will your feature suggestion eliminate X% of security vulnerabilities of a given kind in current C++ code?
No.
Will your feature suggestion automate or eliminate X% of current C++ guidance literature?
It is simpler and more consistent, though it probably doesn't impact teaching much.
Describe alternatives you've considered.
There's nearly always more than one way to improve something. What other options did you consider? Why is the one you're suggesting better than those?
Sticking with cpp1 syntax is workable.