Boost logo

Boost :

Subject: Re: [boost] [outcome] some problems compiling
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-05-24 11:28:52


>>> 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 <windows.h>,
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.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk