On 9/1/11 9:03 PM, Walter Bright wrote:
I'll often use:

*(char*)0=0;

in C++ code :-)

Very handy.

The result might not quite be what you expect with all C++ compilers, though:

———
$ clang -Wall test.cpp
test.cpp:2:5: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
    *(char*)0=0;
    ^~~~~~~~~
test.cpp:2:5: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
1 warning generated.
———

David

Reply via email to