2

ATL/WTL automatically creates skeleton codes with global variable _Module defined. And I've found that WTL expected this to be defined in this specific name till version 7. I also heard that ATL project wizard also generates symbols such as _Handler, _ServiceMain in user namespace.

Isn't this illegal identifier in C++? If so, should I rename it (eg. g_Module)?

vbstb
  • 1,261
  • 1
  • 10
  • 14
  • 2
    Possible duplicate of [What are the rules about using an underscore in a C++ identifier?](https://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier) –  Jan 25 '18 at 13:35
  • 1
    Identifiers with a leading underscore are reserved to the implementer. You did not write this code. – Hans Passant Jan 25 '18 at 14:06
  • @HansPassant But doesn’t “implementer” here refer to the implementer of the compiler and standard library? ATL/WTL is neither (though I know other frameworks which do the same). – Konrad Rudolph Jan 25 '18 at 14:36
  • 1
    That is the kind of quibble that forced implementers into the desperation of `__cdecl` and `__attribute__`, etc. Glad it is not my job. – Hans Passant Jan 25 '18 at 14:42
  • @HansPassant Those would also be invalid by the same rules. ;-) But I agree, it’s not a great situation. I have no idea what the best solution would be. – Konrad Rudolph Jan 25 '18 at 15:09

0 Answers0