Integer conversions too pedantic in 64-bit

Nick Sabalausky a at a.a
Tue Feb 15 13:16:32 PST 2011


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:ijefj9$25sm$1 at digitalmars.com...
> Daniel Gibson:
>
>> void main() {
>>    size_t x;
>>    writefln(typeof(x).stringof);
>> }
>> try this, too ;-)
>>
>> Because it's an alias the information about size_t gone at runtime and
>> the "real" type is shown. uint in your case. (Here - gdc on amd64 - it's
>> ulong).
>
> I think both typeof() and stringof are compile-time things.
>
> And regarding lost alias information I suggest to do as Clang does:
> http://d.puremagic.com/issues/show_bug.cgi?id=5004
>

That would *really* be nice. In my Goldie parsing lib, I make heavy use of 
templated aliases to provide maximally-reader-friendly types for 
strongly-typed tokens (ie, if the programmer desires, each symbol and each 
production rule has its own type, to ensure maximum compile-time safety). 
These aliases wrap much less readable internal types. Expecting the user to 
understand the internal type for any error message is not nice.




More information about the Digitalmars-d mailing list