On Wed, May 24, 2017 at 7:28 AM, Niall Douglas wrote:
2. This class and subsequent functions are defined in anonymous namespace. This means they are redefined and recompiled in each translation unit, and remain a per TU definition. Is that intent?
Yes. Because it's a C source file, you would get symbol collision errors otherwise.
Can't the same effect be achieved with declaring the functions inline? And then you would only get one symbol.
We would then collide with anyone who later includes
, because we are defining the exact same symbol names as windows in order to avoid including windows, so it would be an ODR violation. It's a trick to include windows without including windows which only works on MSVC by taking advantage of its lax parser. That's why on clang we just go ahead and include windows.
Boost libraries already avoid including