Re: [Freeciv-Dev] change includes
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Mitch Davis wrote:
(A clear and informative review of include "" vs include <>)
> So the only reason you'd want to use "" over <> is if you
> definitely wanted to pick up include files out of the
> current directory. Any other percieved difference (such
> as, ``we always use "" to indicate a header in our project, and
> <> to indicate a header outside'' is as a result of misguided
> convention, rather than a true understanding of the
> difference between them.
I would view this slightly differently. I don't think the
convention is misguided, because for an project include file
which is outside the current directory, using "" does still
work, as you explained.
That is, you're suggesting using "" _only_ for files in the
current directory, but using "" does work just as well for
files in other directories too! So for files outside the
current directy, the choice is merely convention.
And the above convention is common, and seems reasonable.
> My preferred
> arrangement for this would be:
>
> #include <system1.h>
> #include <system2.h>
>
> #include <X11/x11a.h>
> #include <X11/x11b.h>
>
> #include <Xaw/xaw1.h>
> #include <Xaw/xaw2.h>
>
> #include <otherdir1.h>
> #include <otherdir2.h>
>
> #include "thisdir1.h"
> #include "thisdir2.h"
I would agree, _except_ have the otherdir includes use "",
by the convention as explained above.
Plus then we get the improved dependencies as Trent points out.
(All this with the proviso you mentioned that we check making
from a directory other than the source dir, though my understanding
is that using "" does exactly what we need here. And if not,
just leave in the -I$(srcdir).)
-- David
|
|