Boost logo

Boost :

Subject: Re: [boost] [#pragma once]
From: Marcus Lindblom (macke_at_[hidden])
Date: 2009-04-10 11:23:31


Edouard A. wrote:
>> Each one of them supports #pragma once. Is there any reason to wrap
>> this pragma within #ifdefs? Are there any compilers out there today
>> that
>> don't support this #pragma?
>
>> Could we change this coding pattern so that it no longer looks like
>> MSVC
>> is being selfish?
>>
> [Edouard A.]
>
> 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.. :(

Cheers,
/Marcus


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