On 15.06.2011 2:03, Andrej Mitrovic wrote:
On 6/15/11, Andrej Mitrovic<[email protected]> wrote:
LOL how the hell did that get in there? I remember I was updating
these samples some time ago.. maybe it was my fault. I am completely
sorry if this was my fault.
Oh wait, it's not my fault! It's a demonstration, see:
case IDC_BTNDONTCLICK:
if (HIWORD(wParam) == BN_CLICKED)
{
MessageBoxA(hWnd, "You've been warned...",
"Prepare to GP fault",
MB_OK | MB_ICONEXCLAMATION);
*(cast(int*) null) = 666;
}
The difference is, DMD can catch this at compile time with
optimizations turned on. I don't know why. Anyway, the example is
supposed to show what happens on a wrong pointer dereference.
I think generic 'windows sample' is _not_ about null pointer dereference
(though arguably one can consider Windows as a whole an example on GP
fault and null pointer dereference in particular).
--
Dmitry Olshansky