On 2020-09-09, at 10:14:05, Bob Raicer wrote: > > On Sun, 6 Sep 2020 16:48:18 -0700 Charles Mills wrote: > > > I'm familiar with the use of NULL as a "special" value. I think > > the C standard says that 0 may never be a valid address. > > The ISO/IEC 9899:20xx "C" standard cites no restriction on the > value zero being an invalid address. > ... The issue concerns attempting to termionate a loop by possible comparison to (type*) (SIZE_MAX+1). This is possibly zero in many hardware architectures. Not allocating the highest byte protects aganst errors there. (AMODE 31 ironically provides a solution.)
> ... > C does not prohibit dereferencing the NULL pointer; rather it makes > it undefined (and implementation dependent) behavior. Certainly, on > an IBM mainframe beginning with the S/360 and continuing to the > present, it would be awkward (and obnoxious) to be unable to > reference the PSA via a pointer variable. > Within my memory, various functions in IBM's C/C++ RTL reported "Invalid Pointer" error on use of NULL as an argument. Apparently so much "portable" source code quietly relies the content of virtual 0 being 0 in various OSes (e.g. by misusing NULL for "") that IBM's RTL now still performs the test but quietly replaces NULL with a pointer to a zero value and reports no error. Feckless accommodation. -- gil
