x.sizeof vs typeid(x)

Robert Fraser fraserofthenight at gmail.com
Wed Feb 6 18:57:51 PST 2008


Walter Bright wrote:
> 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.

typeid yeilds an expression...



More information about the Digitalmars-d mailing list