amazing function behavior

Don nospam at
Wed Oct 21 00:07:39 PDT 2009

Zarathustra wrote:
> Don Wrote:
>> 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.
> Never mind what is stored inside func2. 0x00 is only to simplify the code.
> Tfunc1 - pointer to function without args
> Tfunc2 - pointer to function with 1 arg
> so:
> func2 = cast(Tfunc1)something; 
> doesn't have a sense, because type of func2 is Tfunc2 type not Tfunc1!

Ah, I misread it.

> In D1 this causes compilation error, but DMD2.035 doesn't generate any compilation message, even warning.

Clearly a bug. Please put it into Bugzilla.

More information about the Digitalmars-d-learn mailing list