October 21, 2009 Re: amazing function behavior | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zarathustra | 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. |
October 21, 2009 Re: amazing function behavior | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zarathustra | I resolved my access violation problem by including at the begin of wndProc inside Window class, the following code: //____________________________________________________ private dword wndProc(ptr o_hwnd, dword o_msg, ... { asm{ push 0x00000000; push [o_hwnd]; call [user32.getWindowLong]; mov [EBP - 0x04], EAX; } switch(o_msg){ ... } //____________________________________________________ |
Copyright © 1999-2021 by the D Language Foundation