Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note that unevaluated expression operands are used when the declaration of an object is required but the definition of the object is not. For instance, in the following example, the function f() is overloaded, relying on the unevaluated expression operand to select the desired overload, which is then used to determine the result of the sizeof() expression:

Code Block
languagecpp
int f(int);
double f(double);
 
size_t size = sizeof(f(0));

Such a use does not rely on the side effects of f() and consequently conforms to this guideline.

Noncompliant Code Example (sizeof)

...