Boost logo

Boost :

Subject: Re: [boost] Proposal for #pragma once support
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-06-09 14:26:04

Zachary Turner wrote:

> 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. If
> so, #pragma once is used. so, something like this:
> #if defined(_MSC_VER) /* || defined(OTHER_PRAGMA_ONCE_ENABLED_COMPILER) ...
> */
> #pragma once
> #endif

If you are proposing to add this to every single file to boost, I am afraid
you get to either do it, or provide a script to do this automatically. You
might also have to patch the inspect program to automatically catch headers
that don't have such preamble. Finally, you have to some form of the check
that does not requires that every single header be updated if new compiler
is added to white-list.

Because Boost has >90 libraries now, there's zero chance to have such global
change to happen unless you do necessary automation. And, it would be surely
interesting if Boost itself can benefit from this approach, before we commit
to it.

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at