amazing function behavior
Don
nospam at nospam.com
Tue Oct 20 07:56:58 PDT 2009
Kagamin wrote:
> Zarathustra Wrote:
>
>> Oh, I just find out cause of this behaviour in other module I had:
>> extern (Windows) alias dword function() Tfunc1;
>> extern (Windows) alias dword function(wstr) Tfunc2;
>> const Tfunc2 func2;
>> static this(){
>> func2 = cast(Tfunc1)0x0; // for DMD2 It is not error!!!
>> // but it doesn't has a sens!!!
>> }
>
> looks like a bug
It isn't. Tfunc2 is a function pointer, which is typically the same as
size_t. So any int can be stored inside it. It's generally a very bad
idea to do so, of course.
More information about the Digitalmars-d-learn
mailing list