RE: [GD-General] Redundant Include Guards
Brought to you by:
vexxed72
From: Dirk R. <ri...@ph...> - 2002-12-16 08:25:49
|
At least GCC is smart enough to prevent opening header files if they are guarded by include guard defines and when they are already parsed. Whether this applies to MSVC i do not know. Dirk -----Original Message----- From: gam...@li... [mailto:gam...@li...]On Behalf Of Parveen Kaler Sent: Monday, December 16, 2002 3:27 AM To: gam...@li... Subject: [GD-General] Redundant Include Guards -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Sticking with the theme of compile times. I'm reading Large-Scale C++ Software Design at the moment. The author recommends redundant include guards in .h files: // foo.h #ifndef _INCLUDE_FOO_H_ #define _INCLUDE_FOO_H_ #ifndef _INCLUDE_BAR_H_ #include "bar.h" #endif #ifndef _INCLUDE_VECTOR_ #include <vector> #define _INCLUDE_VECTOR_ #endif //// .... //// #endif So I tried this for a project of mine that consists of about 10KLOC. Compiling with gcc3.2 I saw no difference in compile times. Are compilers like gcc and msvc smart enough to figure stuff like this out? Or is my project just not large enough? The book was written way back in 1996, so I'm figuring some of the advice may be a little out of date. Parveen -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE9/Tnw6jdpm1dGc/cRAiCsAKCb2DuzooUpjSfzd3iFBDO9RexURgCeKHR6 uOTV9eicFER6so6dh5PJyJY= =nVAC -----END PGP SIGNATURE----- ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/ _______________________________________________ Gamedevlists-general mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-general Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=557 |