Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-09-01 12:24:46


From: Roland Schwarz <roland.schwarz_at_[hidden]>
>
> Perhaps we should set up a split directory structure instead?
>
> But then I see two extremes:
> 1) A common header which is the only point where platform specific
> subheaders are ifdeffed into play. Building the lib is a separate issue and
> possibly could be solved by tweaking the bjam accordingly.
>
> 2) A common set of headers that defines the interface only and leave
> implementation to the platform files. However this seems prohibitive
> since this would forbid for platform specific inline optimizations.
>
> Point 1) is at risk, that interfaces start to diverge and 2) still has the
> ugly ifdefs.

Breaking the platform-specific code into separate files keeps
separate things separate and makes everything more readable.
That seems like the appropriate course. However, doing so
doesn't mean the interfaces need to diverge. I suggest this
variation:

3) A common header or set of common headers that declare(s) the
   interfaces plus #ifdefs to include the appropriate
   platform-specific header(s). Thus, when including a.hpp, via
   conditional compilation, you may also get a_1.hpp, a_2.hpp, or
   a_3.hpp. Whether there are corresponding files a_1.cpp,
   a_2.cpp, a_3.cpp, or even a.cpp, is based upon need.

The use of platform-specific headers allows for inline code,
while the common header(s) allow(s) for a simply to grok
declaration of the interfaces.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

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