[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Properly use #include <> and #include ""
From: Michael Olbrich <michael-olbrich () web ! de>
Date: 2007-06-17 17:15:31
Message-ID: 20070617171531.GC18787 () creature ! apm ! etc ! tu-bs ! de
[Download RAW message or body]
On Sat, Jun 16, 2007 at 11:41:07AM +0200, Matthias Kretz wrote:
> Can you make your example a bit more concrete? So far it looks designed to
> break. Any real world examples?
>
> Have you read the rationale on
> http://techbase.kde.org/Policies/Library_Code_Policy#As_library_developer ?
I have, and I think it is wrong. To use the given example: I think
"g++ -I/usr/include/anotherlib -I/usr/include/libxyz ..." should
_always_ fail.
The problem is the following:
Many libraries use the same method to generate the include guards. This
means there is a high probability that /usr/include/libzyx/foo.h and
/usr/include/anotherlib/foo.h have the same guard.
Now in the source you are trying to compile most files contain
#include <xyz.h>
only.
Some files however contain
#include <foo.h>
#include <xyz.h>
most likely because "#include <xyz.h>" was added after
"#include <foo.h>" was already there.
For someone who doesn't know the code this looks like "foo.h" is
randomly not included. An error that is much more difficult to find.
If we use <> instead, all source files will break and the error is much
easier to recognize.
michael
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic