
On Tue, Jun 9, 2009 at 7:58 PM, Scott McMurray<me22.ca+boost@gmail.com> wrote:
2009/6/9 Christopher Jefferson <chris@bubblescope.net>:
One thing to watch out for, in case you don't notice in advance: Some headers should NOT have #pragma once. Not very many, but such files exist. You'll probably want to try to find some way of guessing if a file already has a standard include guard (shouldn't be too hard to detect), and only #pragma once such files.
Which is exactly what GCC does to not need #pragma once =)
(And that check can be made fast by allowing the pathological cases to fall back to the normal include guard behaviour, as that's still safe, whereas #pragma once always has to go the slow route of canonizing all the paths -- which isn't even always possible -- to be safe.)
You're making the same point I was thinking about earlier, which is that in theory #pragma once shouldn't be faster than include guards. So how about this: #include <boost/detail/workaround.hpp> #if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1500) #pragma once #endif Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode