winsamp.d and -O

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Jun 14 15:03:35 PDT 2011


On 6/15/11, Andrej Mitrovic <andrej.mitrovich at gmail.com> 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.


More information about the Digitalmars-d mailing list