Defect Report #077

Submission Date: 03 Dec 93
Submittor: WG14
Source: Clive Feather
Question
Item 14 - stability of addresses
Is the address of an object constant throughout its lifetime? For example, if a pointer to an object is written to a binary file using fwrite, and then read back later during the same run of the program using fread, is it guaranteed to compare equal to the address of the original object taken again?
Response
The C Standard does not explicitly state that the address of an object remains constant throughout the life of the object. That this is the intent of the Committee can be inferred from the fact that an address constant is considered to be a constant expression. The framers of the C Standard considered that it was so obvious that addresses should remain constant that they neglected to craft words to that effect.
The Committee should revisit this issue during the revision of the C Standard.
Previous Defect Report < - > Next Defect Report