
Sorry for last response (I have just got back from holiday :-) I suspect we are all agreed this is correct? If so should it go into our Boost style 'recommendations' docs somewhere? Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Stephan T. Lavavej Sent: Thursday, June 23, 2011 10:43 PM To: boost@lists.boost.org Subject: Re: [boost] numeric_cast
[Fernando Cacciola]
It looks fine to me (except maybe for the #pragma once... is that properly supported on all supported compilers?)
[Brandon Kohn]
Ah, right. We use that at my work (all MSVC). So I'm acclimated. I'll remove those.
Actually, the best thing to do is this:
#ifndef MYPROJECT_MYDIRECTORY_FOOBAR_HPP #define MYPROJECT_MYDIRECTORY_FOOBAR_HPP
#ifdef _MSC_VER #pragma once #endif // _MSC_VER
meow;
#endif // MYPROJECT_MYDIRECTORY_FOOBAR_HPP
This way, all compilers get the portable idempotency guard. Because it's on the outside, GCC (and possibly other compilers) will magically recognize it and avoid opening the header file twice. And the #pragma once for MSVC also instructs it to avoid opening the header file twice, which can improve build perf and can't hurt.
Stephan T. Lavavej Visual C++ Libraries Developer _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost