2 ms·
Can you cite chapter and verse in the standard for this? It certainly does not make sense for current implementations, and I find it difficult to imagine a poi
by asveikau 6y ago
Can you cite chapter and verse in the standard for this?
It certainly does not make sense for current implementations, and I find it difficult to imagine a pointer representation where it does make sense. Perhaps if reading the address itself involved some indirection.
- userbinator 6y agoIn C99: Annex J.2 "The value of a pointer to an object whose lifetime has ended is used (6.2.4)." 6.2.4 "The value of a pointer becomes indeterminate when the object it points to reaches the end of its lifetime." The only thing I can think of is that it allows the compiler to recycle the storage occupied by the pointer itself for something else after free() is called, but I don't see much value(!) in that either, given that if it could do variable lifetime analysis, it would be able to do it for pointers too.
- 0x09 6y agoThis and Annex J.2 Undefined Behavior and Annex L.3 Analyzability Requirements both also specifically include: "The value of a pointer that refers to space deallocated by a call to the free or realloc function is used (7.22.3)."