Kay Ramme - Sun Germany - Hamburg wrote:
Stephan Bergmann wrote:


On unxsoli4 and unxsols4 PRODUCT builds, OSL_VERIFY(a == b) causes a spurious warning "The result of a comparison is unused" (because the argument of OSL_VERIFY is always executed, even for OSL_DEBUG_LEVEL == 0). Instead of disabling the corresponding unxsoli4 and unxsols4 warning, I would vote to change code

  OSL_VERIFY(e);

to

  if (!e) {
    OSL_ASSERT(false);
  }

(and thus work around the warning) on the ground that OSL_VERIFY is dangerous and confusing---unlike the other OSL diagnose functions, it *does* evaluate its argument for OSL_DEBUG_LEVEL == 0. In the interest of the "least surprise" principle, we IMO should deprecate OSL_VERIFY and replace all its occurrences as described above.

Sorry for the (may be stupid) question, but why not just change OSL_VERIFY to emit nothing, in case OSL_DEBUG_LEVEL == 0? I would expect that only weird code would relay on the evaluation in case of a zero debug level. And these case can probably easily be changed to something with "assert" (or ensure).

No, the code I saw was of the form

  OSL_VERIFY(close(f) >= 0);

And when we are on it, what are the differences / purposes between
- OSL_VERIFY
- OSL_ENSURE
- OSL_ASSERT
? Couldn't we consolidate to just _one_ macro. E.g. OSL_ENSURE because of the passed message?

Maybe we could, but *not* on CWS warnings01. We already have enough to do here to get rid of all warnings. If we take the burden of any additional clean up (like unifying OSL_ENSURE and OSL_ASSERT) that is not directly necessary to get rid of warnings, we will drown.

-Stephan

-Stephan

Kay

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to