3 ms·
> IIRC, simply making P point to anything other than an object or 1 past the end of an array is already UB. I don't think this is true in the strict sense you'
by lmm 10y ago
> IIRC, simply making P point to anything other than an object or 1 past the end of an array is already UB.
I don't think this is true in the strict sense you're describing it. Certainly forming a null pointer isn't UB as I understand it, only dereferencing one.
- 0xcde4c3db 10y agoYes, NULL is another exception that I forgot. I'm not sure this is ever explicitly stated as a distinct rule in the standard, but it seems to be implied by various arithmetic and conversion operations on pointers being UB if the result doesn't point to a valid object.