warning

A

asdf

Dear all,

GCC gives me a lot of warning such as
left-hand operand of comma has no effect
right-hand operand of comma has no effect

What does this mean? how to quiet this kind of warning?

thanks a lot.
 
V

Victor Bazarov

asdf said:
GCC gives me a lot of warning such as
left-hand operand of comma has no effect
right-hand operand of comma has no effect

What does this mean? how to quiet this kind of warning?

It means that you have put some expression on the left of
a comma operator and after evaluating it, the result is
thrown out (which may not be what you want, that's why the
compiler is warning you). I don't know how to quiet it
down, RTFM or ask in 'gnu.g++.help'.

This program might produce this warning (I didn't check):
-------------
void foo(int) {}
int main() {
double pi = 3.14, e = 2.718;
foo((pi * e, 42)); // here, maybe
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top