V2015. Identifiers that start with '__' or '_[A-Z]' are reserved.

This diagnostic was added at the request of our users.

As defined by the C++ standard, identifiers that have a double underscore anywhere or begin with an underscore followed by an uppercase letter are reserved for use in the language and standard library implementation. In C, this rule is formulated a bit differently: identifiers that begin with two underscores or an underscore followed by a capital letter are reserved.

Such identifiers may cause problems because of possible clashes with the compiler's reserved identifiers. For example, the compiler may fail to properly optimize the following code:

#include <string.h>

int my_strcmp(const char *s1, const char *s2);
#define __strcmp my_strcmp // <=

void foo(const char *a, const char *b)
{
  ....
  if (!__strcmp(a, b))
  {
    // do something
  }
  ....
}

'__strcmp' could be declared as the built-in (intrinsic) function, which the compiler can optimize better than the direct call of the 'strcmp' function.


Bugs Found

Checked Projects
410
Collected Errors
14 111
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →
Accept