need clarification: will typedef, C struct initialization, etc.

Adam Ruppe destructionator at gmail.com
Wed Jun 2 14:12:38 PDT 2010


On 6/2/10, Simen kjaeraas <simen.kjaras at gmail.com> wrote:
*snip*

I haven't tried your code, but it looks similar to my own code, which
had this problem:

alias Typedef!Int Handle;
alias Typedef!Int OtherHandle;

void foo(Handle h) { }

OtherHandle b;

foo(b); // compiles, but shouldn't. Problem is that Handle and
OtherHandle are both alias of the same underlying thing, so the
compiler considers them the same thing! With the old typedef, I'm
pretty sure it would (correctly IMO) complain here.


More information about the Digitalmars-d mailing list