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

Chris Cain clcain at uncg.edu
Fri May 11 13:23:17 PDT 2012


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);
}
-=-=-



More information about the Digitalmars-d mailing list