3

I have an application that is being built with g++. I added -Wall to the compile flags to cleanup any problems; unused variables, variable used before referenced, comparing signed/unsigned values, etc.

The problem is, I am getting hundreds of lines of junk remarks stating:

remark #981: operands are evaluated in unspecified order

What does this remark really mean? And how do I get rid of it so I can see the valuable warnings/remarks?

Thanks for the help!

Prasoon Saurav
  • 91,295
  • 49
  • 239
  • 345
steveo225
  • 11,394
  • 16
  • 62
  • 114
  • 2
    Could you post (as in copy-paste) some lines of code you're getting that remark on? It's often difficult to tell what a diagnostic means without seeing the code. (Your comment to Prasoon Saurav's question isn't useful, because you claim your lines are like something you quote, and two statements that seem alike to you may be handled differently by the compiler.) – David Thornley May 03 '11 at 18:02
  • All the statements are related to the example I posted in that comment, always using round or abs on signed ints or signed shorts, and always with addition. Sometimes, the results are not stored, but passed by value to a function. I remember using the Intel compiler at work, and there was a way to supress warnings by number (like #981), g++ does not seem to have this, so I am looking for a workaround. Generally, that involves fixing code to be better, but in this case, that seems like a lot of wasted effort. – steveo225 May 03 '11 at 18:12
  • This is not a `g++` warning message, that's an `icc` warning message. Intel's own people say it's useless, here: http://software.intel.com/en-us/forums/showpost.php?p=72053 – Cubbi May 03 '11 at 18:24
  • I am definitely getting it from `/usr/bin/g++` version 3.4.6 But yes, I have gotten, and ignored, that error using `icc` at work. – steveo225 May 03 '11 at 18:27

1 Answers1

0

Actually it is unspecified in standard but should be consistent for systems programming. Some compilers[which use Polish notation transformation before evaluation] use priorities, some compilers[which use tree transformation before evaluation] evaluate them in the strict right-to-left order.

Erkin Alp Güney
  • 218
  • 6
  • 15