Cannot alias null
Tom Browder via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 12 14:06:56 PDT 2014
On Thu, Jun 12, 2014 at 3:42 PM, H. S. Teoh via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:
> On Thu, Jun 12, 2014 at 03:26:13PM -0500, Tom Browder via Digitalmars-d-learn wrote:
>> This will not compile:
>>
>> alias blah = null;
> [...]
>
> 'null' is a value, not a type. Try:
>
> alias blah = typeof(null);
Great, that works!
What I was really trying to do was D'ify C expressions like this:
typedef ((struct t*)0) blah;
So, taking your advice, I found this to work (at least it compiles as
a translation:
alias blah = typeof(null);
Thanks,T and Ali.
Best,
-Tom
More information about the Digitalmars-d-learn
mailing list