
I'm basically with everyone who's been saying to just not bother using "#pragma once" since the idiomatic ifdef guards work fine and unless there are some real benchmarks, I don't think it's worthwhile trying to bend over backwards to take advantage of something that's non-standard. I'm just not convinced there are any actual gains here. On Fri, Apr 10, 2009 at 11:33 AM, Remko Tronçon <remko@el-tramo.be> wrote:
Anyway, I understand that a library like Boost doesn't want to rely on this, but personally, but it sounds sane to me that other projects (that are less depended on and don't need to support a gazillion of compilers) use it.
Alright, I'll agree with this. While I'm not convinced it's a great idea for boost to use #pragma once, a library macro for users that uses it when available might make sense. Assuming _Pragma support, it's trivial to provide a macro BOOST_INCLUDE_ONCE that is defined as _Pragma( "once" ) in compilers that support it and nothing in compilers that don't (avoiding possible unrecognized pragma warnings). An alternative is a macro that produces a compile-time error if it's not supported. -- -Matt Calabrese