Re: [GD-General] Redundant Include Guards
Brought to you by:
vexxed72
From: Javier A. <ja...@py...> - 2002-12-16 08:26:37
|
gcc detects include guards automatically and will not reopen a guarded header, at least it used to... msvc has the #pragma once thing so I guess it doesn't autodetect guarded headers. That said, the first thing you want to do is structure your code and headers so that the number of header files included by other headers files (main source of re-includes) is minimal. Once you're there, redundant include guards buy you less and less. Parveen Kaler <pk...@sf...> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > > 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: > > 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. Javier Arevalo Pyro Studios |