Why typedef's shouldn't have been removed :(

Robert DaSilva spunit262 at yahoo.com
Fri May 11 15:58:01 PDT 2012


On Friday, 11 May 2012 at 20:23:18 UTC, Chris Cain wrote:
> On Friday, 11 May 2012 at 20:14:29 UTC, Andrej Mitrovic wrote:
>> On 5/11/12, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>>> Since null is its own type now..
>>
>> What were the use-cases for making it a type? Seems odd to 
>> declare it:
>> typeof(null) x;
>>
>> I mean what could you do with such a type?
>
> It apparently implicitly converts to any pointer type (but you 
> must cast in order to store in it...)
>
> -=-=-
> import std.stdio, std.conv;
> void main() {
>     typeof(null) x;
>     int y = 5;
>     x = cast(typeof(null)) &y;
>     int * z = x;
>     double * d = x; // wat
>     writeln(*z);
>     writeln(*d);
> }
> -=-=-

cast voids the warranty, especially cast(typeof(null))


More information about the Digitalmars-d mailing list