Boost logo

Boost :

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


On 24/05/2017 13:02, Glen Fernandes via Boost wrote:
> 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.
>
> Boost libraries already avoid including <windows.h> by leveraging
> Boost.WinAPI which provides the definitions necessary (and are added
> to as needed).
>
> Your use of an unnamed namespace for the types is questionable.
> Depending on the compiler, I think you should want to decorate them
> with __attribute__ ((__may_alias__)).

The code in question is in a sub-sub-library which is itself completely
standalone and reusable. It is Windows only because it implements a
common POSIX API for Windows, so such attributes won't be useful. And
that code would only ever get used if someone didn't configure a better
stack backtrace printer.

But I've been surprised by the number of people using winclang over
MSVC, so I am open to doing better than including <windows.h> on
winclang. Logged to https://github.com/ned14/boost.outcome/issues/39

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