Statically forbid string ~ size_t ?

Nick Sabalausky a at a.a
Thu Oct 13 17:31:44 PDT 2011


"Marco Leise" <Marco.Leise at gmx.de> wrote in message 
news:op.v3a8isjg9y6py2 at marco-leise.homedns.org...
>Am 13.10.2011, 23:11 Uhr, schrieb Steven Schveighoffer 
><schveiguy at yahoo.com>:
>> I think in order to disallow this, you have to disallow dchar = size_t.
>>
>> IMO, I think it's worth it.  It's very uncommon to create a dchar using 
>> an integral.
>>
>> -Steve
>
>I recently wrote JavaScript code that generates a Greek letter starting 
>with ? (alpha) from an integer. It's just the shortest way to do it that 
>works in most languages based on C syntax. I assume I could do it another 
>way.

Yes:

c = cast(char)123; // Or whatever code-unit desired

>Like initializing with a character and then incrementing by the index  of 
>the letter I want. 




More information about the Digitalmars-d mailing list