Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-09-01 10:50:04


Tim Taylor wrote:
> Thanks for your help Jonathan.
>
> Regarding my comment on the #includes, it's just a minor stylistic
> point which you can take or leave. My point was just that, in my
> experience, common practice is to use #include <..> for files from
> different libraries, and #include "..." only for files from your own
> project.

Boost uses a mix of <> and "" to include Boost headers. I don't think it's a
universal custom to use "" only for headers in the same library, but I'll switch
if there's a consensus.

> Of course the only difference is that the <> version looks
> for files in the include path, and the "" version first looks in the
> current directory and then in the include path.

This stuff is implementation-defined, I believe; it just happens to work this
way with most (but not all) compilers.

> Using <> to include
> headers from other libraries is therefore *slightly* safer I guess,
> if only in the unlikely situation where you have a header file with
> the same name in the current directory; with <> you know you're using
> the library's own version of the header file and not your own (which
> would generally be the desired action unless you specifically wanted
> to override the library's own version). Additionally, from a
> readability point of view, <> makes it clear that the header is from
> another library.

Maybe I shouldn't have removed the comments explaining where the headers came
from. I'll put them back in.

> As I say, this is a minor point, and feel free to ignore it!
>
> Tim

Jonathan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net