#ifdef considered harmful (was: DData)

Robert Will robertw at stud.tu-ilmenau.de
Tue Apr 20 15:36:07 EDT 2004

On Fri, 16 Apr 2004, Keith Wansbrough wrote:
> Which do you add more often, a new platform or a new function?

It's not that simple!  The real advantage of the ifdef-less approach is
that you start creating an interface between your program and the
platform.  That is a unique benefit for the program's design.

If you add a new function (or remove a bug, by the way), are you the
super-hero that can write perfect code for all currently implemented
platforms?  Or would you prefer that you have that small interface and
good chances that you can solve your problem by calling its functions.
Otherwise you'll be happy to consult the adaptor-module's maintainer to
find a proper solution.  In a perfect world, everyone does his best to
avoid incompatibilties.  In our world, you have to be a super-hero to
write good code...


More information about the Libraries mailing list