Versions Compared

Key

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

...

An appropriate coding or design technique should be used to avoid the runtime static initialization of namespace scope objects. The best solution is often simply to avoid using such variables, to the extent practical.

Code Block
bgColor#ccccff

Exceptions

When a function call appears in some contexts, notably as the argument in a sizeof expression, the compiler performs overload resolution to determine the result type of the call, but the object code doesn't execute the call at runtime. In that case, calling a variadic function does no harm, and can actually be very useful.

Compliant Code Example

, especially when using template metaprogramming techniques that exploit SFINAE ("substitution failure is not an error").

#ccccff
Code Block
Code Block
bgColor
typedef char True;
typedef struct { char a[2]; } False;

template <typename T>
True isPtr(T *);

False isPtr(...);

#define is_ptr(e) (sizeof(isPtr(e)) == sizeof(True))

...