I am a C++ newbie and I'd like to trace the evaluation of some
expressions of my programs. I tried to use the comma operator for
that, but failed. I used a simple code substitution for expressions to
accomplish that. ... Something like ...
char * s = "foo";.... I transformed into something like ...
extern void trace();.... but my compiler (g++ 4.1.2) complained
char * s = (trace(), "foo");
(error: invalid conversion from 'const char*' to 'char*')!
What's wrong about my code substitution? The standard says (5.18 comma
operator):
"The type and value of the result are the type and value of the
right operand; the result is an lvalue if its right operand is."
Why does qualification conversion (4.4) not apply anymore???
-Matthias
--
Matthias Neubauer |
Universität Freiburg, Institut für Informatik | tel +49 761 203 8060
Georges-Köhler-Allee 79, 79110 Freiburg i. Br., Germany | fax +49 761 203 8052