Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2001-07-20 10:18:23

> From: "Vesa Karvonen" <vesa.karvonen_at_[hidden]>
>The item 1.7. of the C++ Coding Guidelines mentions using forward declarations
>for avoiding compile-time dependencies. I strongly agree with using forward
>declarations for the purpose of avoiding compile-time dependencies. I would
>like to see the practice of having a forward declaration header per library as
>a requirement or at least a strong recommendation in Boost.
>Forward declaration headers have two main purposes:
>- facilitate reducing compile-time dependencies
>- act as an effective form of documentation
>In my experience, one forward declaration header per library is sufficient. If
>a library changes so frequently or is so big that multiple forward declaration
>headers seem necessary, then the library should usually be refactored. I've
>been using forward declaration headers for many years and had nothing but
>positive experience.
>I feel that the lack of forward declaration headers in the standard library,
>except for streams, is a significant cause of unnecessary problems and
>confusion with the standard library.

I am in total agreement with this proposal. I proposed a similar
practice for Boost a couple of years, but the climate of Boost has
changed a bit since then -- IIRC, discussing coding guidelines was
practically a no go area :->

The absence of this practice (except for <iosfwd>) in the standard
library is a nuisance. Boost is increasingly being seen as a place to
look to for practices in library building, so this is an excellent
opportunity to make this practice more widespread.


  Kevlin Henney phone: +44 117 942 2990
  mailto:kevlin_at_[hidden] mobile: +44 7801 073 508 fax: +44 870 052 2289
  Curbralan: Consultancy + Training + Development + Review

Boost list run by bdawes at, gregod at, cpdaniel at, john at