This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
[SUGGESTION] sizeof<T>
vs sizeof(T)
and sizeof(expr)
#582
Labels
You can continue the conversation there. Go to discussion →
sizeof<T>
vs sizeof(T)
and sizeof(expr)
#582
This is about consistent concepts rather than just syntax.
From #574 (comment) Herb said:
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 likesizeof(int)
. So I thinksizeof<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 writesizeof(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 usingdecltype
for that.No.
It is simpler and more consistent, though it probably doesn't impact teaching much.
Sticking with cpp1 syntax is workable.
The text was updated successfully, but these errors were encountered: