x.sizeof vs typeid(x)
Walter Bright
newshound1 at digitalmars.com
Wed Feb 6 18:51:49 PST 2008
Sergey Gromov wrote:
> I wonder why .sizeof is implemented as a property while typeof() and
> typeid() are functions. I can see no reasons for such inconsistency.
> It's not that obvious for typeof() because it yields a type instead
> of a value, but even then, why not ?
Because expression.identifier always yields an expression, whereas
typeof() always yields a type. It makes parsing easier and more consistent.
More information about the Digitalmars-d
mailing list