On 5/18/21 10:55 AM, Peng Yu via Gcc-help wrote: > NULL (0) is a commonly used value for an invalid memory address. I > also see -1 is used for an illegal memory address. > > Besides those values, I'd suspect that other values that are close to > 0 (both negatives and positives) won't appear in real programs. > > Is there a limit on the safe range that can be assumed to not be used > by user level code as valid addresses? There is no such list that defines which virtual addresses are valid and which are not. It depends on your OS, target, system config, etc. I've heard of some OS systems where 0 was ok to access and NULL was defined to be some other non-zero value. Also, -1 is sometimes valid too. If you're running on a ppc64 (ie, big-endian) Linux kernel and execute a 32-bit application and your system has enough memory, the kernel will give you the full 4G virtual address space to your application. Peter