Document Number: WG14 N913 Docuemnt Date: 13-Apr-2000 1. Title Object access model for the programming language C. 2. Scope To define an unambiguous model for the evaluation status of a full expression in the C language (as defined by ISO/IEC 9899:1999). 3. Purpose and Justification The C Standard puts certain restrictions on expressions based on the concept of a "sequence point". Clause 6.5p2: Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be accessed only to determine the value to be stored. The problem with this and other wording is that, while its meaning seems obvious at first glance, it is open to different interpretations by different people. For example, in (with x having an integer type): (x += 0) + (x *= 1); neither assignment to x alters the stored value, and some readers would argued that neither modifies it and the behaviour is defined; while others would argue that modification can involve storing an unchanged value back into an object, the behaviour is undefined in this case. Optimizers want the freedom to rewrite expressions to generate efficient code; but the standard constrains the rewriting that is allowed. Developers want the expressions they write to always evaluate to the same value; but the standard does not always guarantee such an evaluation. The output from the proposed model is a YES/NO answer to the question: is the result of the full expression input to the model unambiguously defined? The model will take into account the full state of the abstract machine during the evaluation of the expression. The model will follow existing practice. The intent is to clarify the current behaviour and help different readers to arrive at the same result. It is expected that a number of issues involving the evaluation of expressions will be found over time. It is hoped that as experience with the final, published model grows, it might eventually be considered for inclusion in a future revision of the C standard. 4. Program of Work A Technical Report Type 2 will be developed for this project. 5. Relevant documents to be considered ISO/IEC 9899:1999 -- Programming Languages C WG14 N908 A formal model of sequence points and related issues 6. Cooperation and liaison All ISO/IEC JTC1/SC22 Working groups that have an interest in having an unambiguous interpretation of C expressions. In particular ISO/IEC JTC1/SC22 WG21 (C++). 7. Preparatory work offered with target date(s) A PDTR document will be ready for registration 24 months after the approval of the project by JTC1.