warning

Feb 19, 2013 at 4:39pm
what is the meaning of this warning?
Ambiguous operators need parentheses in function main ().
Feb 19, 2013 at 5:51pm
it helps if you show us the code that's causing that warning.
Feb 20, 2013 at 5:07am
so why this warning is comming
Feb 20, 2013 at 5:13am
I don't know. I can't see the code that's causing it.

I can only guess that you're getting the warning because you are using ambiguous operators, and to correct it you would have to use parenthesis. The problem is likely in the main() function.
Last edited on Feb 20, 2013 at 5:14am
Feb 20, 2013 at 6:31am
i hv get wht u r saying but if there is:
cout<<x+x;
here we have to use parenthesis but why explain me
Feb 20, 2013 at 4:53pm
The compiler is telling you that you probably should do this:

cout << (x+x); to make your intentions more clear.

However, + has a higher precedent than <<, so it isn't actually necessary. Your compiler is just being overly cautious. Maybe you can try reducing the warning level in your compiler settings... or just put parenthesis around it.

I would do the latter -- I prefer putting parenthesis wherever there is possibility for confusion. Not everyone has the order of precedence memorized, so I like to clarify it whenever possible.
Topic archived. No new replies allowed.