Boost logo

Boost :

Subject: Re: [boost] Proposal for #pragma once support
From: Christopher Jefferson (chris_at_[hidden])
Date: 2009-06-11 15:15:20


On 11 Jun 2009, at 19:40, Nevin :-] Liber wrote:

> 2009/6/9 Zachary Turner <divisortheory_at_[hidden]>
>
>> I would like to propose conditional support for #pragma once be
>> added to
>> all
>> header files in boost. This would involve, at the beginning of every
>> header
>> file, a preprocessor check to determine whether or not the particular
>> compiler is on a whitelist of known compilers to optimized #pragma
>> once.
>
>
> 1. To make a case for using the non-portable #pragma once vs.
> portable
> include guards, you'll have to come up with metrics comparing
> #pragma once
> with include guards and show that #pragma once is significantly
> faster for
> the compilers listed at <
> http://www.boost.org/development/tests/release/developer/
> summary.html>.
>
> 2. When compilers get #pragma once wrong (as in <
> http://gcc.gnu.org/ml/gcc-bugs/2009-01/msg03268.html> earlier this
> year),
> who exactly is going to revert all of Boost back?
>
> 3. The semantics of #pragma once are different than the semantics of
> include guards (I believer that #pragma once tends to use the OS
> notion of
> identical files, and can fail under certain pathological cases). We
> would
> still need include guards everywhere for correctness.

While I agree (1) needs doing, both (2) and (3) fall under the same
category. I don't believe anyone is suggesting header guards be
removed, and all bugs in #pragma once I've ever seen have involved
multiple inclusions of a file, not skipping a file.

Chris


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