On Jun 21, 4:33 am, Lighter <cqu...@gmail.comwrote:
How to read "The lvalue-to-rvalue, array-to-pointer, and function-to-
pointer standard conversionsare not applied to the left expressions"?
In 5.18 Comma operator of the C++ standard, there is a rule:
"The lvalue-to-rvalue, array-to-pointer, and function-to-pointer
standard conversions are not applied to the left expressions"
I could not understand what the rule means. I also searched the web
and the groups and got nothing.
Well, it means that the lvalue-to-rule, array-to-pointer and
function-to-pointer conversions are not applied to the left
operand of a comma operator. That seems clear enough, per se;
what part don't you understand?
In general, I can't really see how a conforming program could
tell whether they were applied or not. For example, if I write:
int array[ 10 ] ;
array, f() ;
how can I possibly know whether the type of the right operand of
the comma is int[10] or int*? And how can it matter?
I suppose that it is really only significant with regards to
whether the type must be complete, or whether there must be a
definition.
class C ;
C* pC ;
*pC, f()
is legal, but it wouldn't be if an lvalue-to-rvalue conversion
took place (since the standard requires a complete type any time
there is an lvalue-to-rvalue conversion). Similarly, given:
extern int g() ;
extern int a[] ;
g, f() ;
a, f() ;
I think (but I'm far from sure) the fact that the function to
pointer conversion doesn't take place on g means that g is not
used in this expression, and thus that no definition is
required. And the same thing holds for a, because the
array-to-pointer conversion doesn't take place.
At any rate, that's the only real relevance I can see.
--
James Kanze (GABI Software, from CAI) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34