Boost logo

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):


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