Re: _Complex_I



Harald van Dijk <truedfx@xxxxxxxxx> writes:
[...]
Where does the C standard require that lvalues are converted to rvalues by
accessing the object?

The C standard doesn't use the term "rvalue" except in a footnote in
section 6.3.2.1:

What is sometimes called "rvalue" is in this International
Standard described as the "value of an expression".

So assuming that evaluating, say, an object name yields the value of
the object, it follows from the definition that the result is an
rvalue.

On the other hand, C99 6.5.1p2 says:

An identifier is a primary expression, provided it has been
declared as designating an object (in which case it is an lvalue)
or a function (in which case it is a function designator).

I don't see an explicit statement that the result is the value of the
object. It seems obvious; either it was considered too obvious to
bother stating, or I'm missing an explicit statement somewhere else.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.



Relevant Pages

  • Re: Casting double to int produces inconsistent results from VS 2003 to VS 2008
    ... Some things in the standard are ... 4.8p1 An rvalue of floating point type can be converted to an rvalue of ... another floating point type. ... the result of the conversion is ...
    (microsoft.public.vc.language)
  • Re: copy constructors and printf
    ... Basically they imply that an rvalue ... the copy constructor until the va_arg call correct? ... but I remember seeing somewhere in the Standard (I can't find ... TIA, Dave Moore ...
    (comp.lang.cpp)
  • Re: Whats going on here?!
    ... > the rvalue to be created. ... can anyone tell me why the standard allows a copy of the rvalue to be ... Foo const& f = makeFoo(); //temporary lasts as long as f. ...
    (microsoft.public.vc.language)
  • Re: returning lvalue in C vs C++
    ... basis that fis an rvalue, and a method call on an ... rvalue is OK, but an rvalue on the lhs of an assignment is not. ... But I thought that the expression rvalue.x makes x an lvalue, because The Standard didn't say that rvalue.x must be an rvalue. ... However, I have CHANGED MY STANCE on when assignment is allowed: I now think the standard is too unclear for a straight answer such as the one I gave, which, as I see it know, may even be considered /incorrect/. ...
    (comp.programming)
  • Re: _Complex_I
    ... What is sometimes called "rvalue" is in this International ... I think what he meant is that even though 6.3.2.1 says that the lvalue is converted to the value of the object, it does not say that it's converted *by* accessing the object: if the compiler can prove that it knows what value the object must have, the conversion can produce that value without accessing the object. ... the result is an lvalue designating the object. ...
    (comp.std.c)