|
Boost : |
From: Glen Knowles (gknowles_at_[hidden])
Date: 2002-08-06 15:48:52
From: Beman Dawes [mailto:bdawes_at_[hidden]]
> > I'm not sure his suggested implementation was addressed. My
understanding
> > is that he was advocating separate files for the implementations of, at
> > least, the major operating system "families". This would compile only
the
> > files required for a given platform, with the hope of needing much less
> > #ifdef clutter. Not the pimpl idiom, unless you wanted to classify it as
> > a compile time pimpl. :)
> >
> You just can't win on this question. In the alpha of boost::filesystem, I
> had separate implementation files for POSIX and Windows. I got complaints
> about that. I changed to single files with #ifs, and got a complaint
about
> that.
>
> The key factors to me were that with the single file with #ifs:
>
> * It made maintenance easier and prevented divergence of semantics
between
> implementations. Note that the majority of the code was not within #ifs,
> and so appeared only in one place instead of two.
>
> * It was easier to inspect to determine if the two implementations had
the
> same semantics.
>
> * It made compilation and test easier.
>
> * Over time, and in ways I can't quite put my finger on, the single file
> with #ifs just came to feel like better software engineering. KISS I
guess.
My experience has been with systems supporting only two or three platform
families. In these situations I completely agree with you, even with not
quite being able to put my finger on it. That said, I suspect that when you
support more then two or three separate implementations its easier to do
it in separate files.
Glen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk