Defect Report #166
Submission Date: 16 Oct 95
Source: Clive D.W. Feather
Submitted to BSI by Clive D.W. Feather firstname.lastname@example.org .
In this Defect Report, identifiers lexically identical to those
declared in standard headers refer to the identifiers declared in those
standard headers, whether or not the header is explicitly mentioned.
This Defect Report has been prepared with considerable help from
Mark Brader, Jutta Degener, Ronald Guilmette, and a person whose
employment conditions require anonymity. However, except where stated,
opinions expressed or implied should not be assumed to be those of any
person other than myself.
Defect Report UK 014: Meaning of lvalue
Constraints that require something to be an lvalue place an
unacceptable burden on the implementation.
Subclasue 188.8.131.52 states in part:
An lvalue is an expression (with an object type or an incomplete
type other than void) that designates an object.
Given the declaration
int a, i;
the expression a[i] designates an object,
and is thus an lvalue, if and only if i has a value
between 0 and 9 inclusive (see Defect Report #076 for further details).
Now consider the Constraint in subclause 184.108.40.206:
The operand of the unary & operator shall be
either a function designator or an lvalue that designates an object ...
This means that the expression &a[i] is a
constraint violation whenever i has a value outside
the range 0 to 9 inclusive, and that therefore a diagnostic is
required, at run-time!
The defect is that the operand of the unary &
operator does not need to be an lvalue that designates an object, but
rather an lvalue which, if evaluated with its operands having suitable
values, could designate an object.
There are probably other parts of the C Standard with the same
problem, such as subclauses 220.127.116.11, 18.104.22.168, and 6.3.16.
Previous Defect Report
< - >
Next Defect Report