typedef redux

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Nov 13 09:33:25 PST 2009


Moritz Warning wrote:
> On Thu, 12 Nov 2009 09:37:07 -0600, Andrei Alexandrescu wrote:
> 
>> My perception following the discussion around typedef is that we should
>> eliminate it. What we offer is "alias", which is a generalization of C's
>> "typedef", and the change of name is justified by the fact that "alias"
>> defines aliases for more entities than just types.
>>
>> Does all that sound good?
>>
>>
>> Andrei
> 
> Sounds good to me.
> 
> typedef void* FooRef;
> 
> can be replaced by (at least in most cases):
> 
> struct Foo {};
> alias Foo* FooRef;

Even better:

struct Foo;
alias Foo* FooRef;

That way people won't be able to erroneously pass Foo by value.


Andrei



More information about the Digitalmars-d mailing list