[GD-General] Redundant Include Guards
Brought to you by:
vexxed72
From: Parveen K. <pk...@sf...> - 2002-12-16 02:26:37
|
-----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----- |