From kde-core-devel Sun Jun 17 17:15:31 2007 From: Michael Olbrich Date: Sun, 17 Jun 2007 17:15:31 +0000 To: kde-core-devel Subject: Re: Properly use #include <> and #include "" Message-Id: <20070617171531.GC18787 () creature ! apm ! etc ! tu-bs ! de> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=118210059325602 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--iFRdW5/EC4oqxDHL" --iFRdW5/EC4oqxDHL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 t= o=20 > break. Any real world examples? >=20 > Have you read the rationale on=20 > 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 only. Some files however contain #include #include most likely because "#include " was added after "#include " 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 --iFRdW5/EC4oqxDHL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGdWwz3fK8vSqP5HsRArsRAJ9rn+IxEwfrS9Tjn4zgBCRlL4VLcgCeNM+y sTgA6DXQHHEQp9zFu8IZmQs= =sE1T -----END PGP SIGNATURE----- --iFRdW5/EC4oqxDHL--