
10 Apr
2009
10 Apr
'09
3:23 p.m.
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