|
Boost : |
Subject: Re: [boost] [#pragma once]
From: Yanchenko Maxim (maximyanchenko_at_[hidden])
Date: 2012-11-16 15:12:34
10.04.2009, 23:26, "Marcus Lindblom" <macke_at_[hidden]>:
>> In addition #pragma once may be faster than #ifndef/#endif because the
>> compiler is not even going to open the file a second time to parse the
>> #ifndef/#endif.
>
> I've seen benchmarks that say some compilers (gcc, msvc) are smart
> enough to recognize #ifndef/#endif and do the #pragma once equivalent.
> (i.e. there's no discernable performance difference.)
>
> Can't find the link now though.. :(
>
It's in the docs of GCC, for example (even the ancient version 2.95.0 was optimized not to read same file twice if guards surround the whole file):
http://gcc.gnu.org/onlinedocs/gcc-2.95.3/cpp_1.html#SEC8
Thanks,
Maxim
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk