News for hackers. Stuff that matters.
Re:*(char*)0 = 0; - What Does the C++ Programmer Intend with... by monocasa on Tuesday October 17, 2023 @04:03PM (#37920778)
> Find me one contemporary example (ANSI C) with a disassembled screenshot.

Here in godbolt, clang compiling C simply deletes the code in the function past and including the null pointer dereference.

https://godbolt.org/z/9aqWPazsP

> This is writing sizeof(char) (== 1 almost everywhere)

1 everywhere. sizeof's unit is "how many chars". For instance there was a cray machine that could only access 64bit words. sizeof(char) is still 1, with 64bit chars.

> zero to address zero. It is not using a NULL macro or other predefined symbol.

NULL is defined as literal 0.

Re:*(char*)0 = 0; - What Does the C++ Programmer Intend with... by gpderetta on Tuesday October 17, 2023 @05:00PM (#37921490)
make it a '*(volatile char*)0 = 0' to force the store.