NotNull pointers

dsimcha dsimcha at yahoo.com
Mon Aug 29 13:32:52 PDT 2011


== Quote from Walter Bright (newshound2 at digitalmars.com)'s article
> For the latest dmd,
>
https://github.com/D-Programming-Language/dmd/commit/1193f7828b444056c943742daae0a5ccf262272e
> ,
>   I've implemented the ability to disable default initialization. This makes it
> practical to implement a library based "NotNull" type without a special syntax
> for it.

How does it work for member variables of classes and structs?  E.g.:

// Is this legal or not?
struct Foo
{
    NotNull!(int*) notNull;

    this(int* ptr)
    {
        notNull = ptr;
    }
}


More information about the Digitalmars-d mailing list