microsoft / wil

Windows Implementation Library
MIT License
2.58k stars 236 forks source link

reserved identifier violation #21

Open elfring opened 5 years ago

elfring commented 5 years ago

I would like to point out that an identifier like “__WIL_RESOURCEdoes eventually not fit to the expected naming convention of the C++ language standard. Would you like to adjust your selection for unique names?

dunhor commented 5 years ago

This has been brought up a few times in the past. From what I recall, the decision was to avoid populating auto-complete suggestions with internal macros that shouldn't be used. Something like _wi_MACRO might be a viable alternative, but __WI is unique enough that I don't think that this is likely to get addressed

elfring commented 5 years ago

How do you think about to avoid that this software depends on undefined behaviour?

sylveon commented 5 years ago

They wrote the compiler :P

elfring commented 5 years ago

Do the provided source files belong to the implementation of a compiler for the programming language “C” or “C++”?

DBJDBJ commented 5 years ago

C++

ChrisGuzak commented 5 years ago

thanks for pointing this out. I was aware of _Upper, but not the __doubleUnderscore rule. What do you suggest and what conventions exist that we could follow that meets the goals of

DBJDBJ commented 5 years ago

There is no total name collision avoidance schema

WIL_RESOURCE__ would be good enough. Carefully placed #undef -s might help, but that is the path peppered with shards of glass...

elfring commented 5 years ago

The probability for name clashes can be considerably reduced, can't it?

DBJDBJ commented 5 years ago

It can indeed

j-schultz commented 2 years ago

It would be great if something can be done about this since the apparent original intent - making development less noisy for users of the library - is now turned into the opposite for users that also apply e.g. clang diagnostics to their codebase - which can be worked around by adding #pragma clang diagnostic ignored "-Wreserved-identifier" to any code block using functionality like RETURN_IF_FAILED, but if there's lots of code using these WIL features, it kinda makes it a bit pointless to enable that warning at all.