Boost logo

Boost :

From: craigp_at_[hidden]
Date: 2002-12-30 08:59:19


Doesn't MSVC support pre-compiled headers? This will speed up compilation
much more than '#pragma once'. Try creating a common header file which
includes all of your project's header files, and have all source files
include the common header, and compare compile times.

> "#pragma once" is just an optimization issue. If a file is included a
> second time in the same TU, a dumb compiler will re-open it and give it
> to the preprocessor who strips its contents entirely because the include
> guard is already defined. Re-opening + preprocessing takes little but
> significant time.
>
> With the "#pragma once" the programmer just gives an hint to the
> compiler that re-opening is unnecessary and ignores the #include
> directive immediately. You see, there *is* a speed gain even in the
> presence of canonical include guards.

HTH,
--craig


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk