Boost logo

Boost :

Subject: Re: [boost] [#pragma once]
From: Bo Persson (bop_at_[hidden])
Date: 2009-04-11 04:49:06


Raindog wrote:
> Niels Dekker - address until 2010-10-10 wrote:
>>
>> BTW, #pragma once has been discussed extensively at comp.std.c++,
>> December 2007: "#pragma once in ISO standard yet?"
>> http://groups.google.com/group/comp.std.c++/browse_thread/thread/c527240043c8df92
>>
>> Apparently it's hard to implement such a #pragma in a reliable way.
> From what I understand, it's also hard to implement templates and
> multiple inheritance...or exception safety in code...but we have
> those =)

The #pragma once depends on the compiler being able to correctly parse
the include paths for all possibly attached file systems. If it fails,
it might include the same file twice from seemingly different paths.

With the #ifdef/#endif idiom, an occational extra include just adds a
small amount of time to the compile.

Bo Persson


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