Laurent GUERBY wrote: > Just curious: is there a "portable" way to read from memory > address zero in C code? "portable" here means likely to work > on most compilers without exotic compile flags in 2009. > For C++, in *theory*, a reinterpret_cast<void*>(0) yields a pointer with the value 0 that is not recognized as the null pointer.
For C and C++, the same thing can be achieved by casting an integer variable with the value 0 to a pointer. (You only get the null pointer constant by casting an integral constant expression with value 0.) In practice, i.e. under your definition of portable, I have no idea. Sebastian