|
Boost : |
Subject: Re: [boost] numeric_cast
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2011-07-11 11:53:14
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_at_[hidden] > -----Original Message----- > From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of Stephan T. > Lavavej > Sent: Thursday, June 23, 2011 10:43 PM > To: boost_at_[hidden] > 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk