Boost logo

Boost :

Subject: Re: [boost] numeric_cast
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2011-06-23 17:43:02

[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:


#ifdef _MSC_VER
    #pragma once
#endif // _MSC_VER



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

Boost list run by bdawes at, gregod at, cpdaniel at, john at