Boost logo

Boost :

Subject: Re: [boost] ATTENTION: Library requirements..
From: Rainer Deyke (rainerd_at_[hidden])
Date: 2016-01-10 05:12:22


On 10.01.2016 05:26, Glen Fernandes wrote:
> If there are macros in your public headers that are defined but
> always undefined, then it won't impact users of your library.

That's not necessarily true. Consider:

> For example, for Boost.Something, in boost/something/file.hpp:
>
> #ifndef BOOST_LIBRARY_SOMETHING_FILE_HPP
> #define BOOST_LIBRARY_SOMETHING_FILE_HPP
> // ...
> #if defined(__INTEL_COMPILER)
> #define BOOST_SOMETHING_USING_ICC
> #endif
> // ...
> #if !defined(BOOST_NO_CXX11_ALLOCATOR)
> #define SHOULD_USE_ALLOCATOR_TRAITS
> #endif
> // ...
> #undef SHOULD_USE_ALLOCATOR_TRAITS
> // ...
> #endif

#define SHOULD_USE_ALLOCATOR_TRAITS
#include <boost/something/file.hpp>

#ifndef SHOULD_USE_ALLOCATOR_TRAITS
#error Where did my macro go?
#endif

-- 
Rainer Deyke (rainerd_at_[hidden])

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