Boost logo

Boost Users :

Subject: Re: [Boost-users] conflicting intmax_t definitions - Boost 1.53 and gcc 4.8 incompatibility?
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2014-01-21 05:24:47


> -----Original Message-----
> From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Gavin Lambert
> Sent: Tuesday, January 21, 2014 1:24 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] conflicting intmax_t definitions - Boost 1.53 and gcc 4.8
incompatibility?
>
> On 21/01/2014 02:21, Quoth John Maddock:
> > Boost does define it's own intmax_t etc *in namespace boost*, if you
> > import these into the global namespace then expect things to break,
> > sorry but that's the way it's *always* been. My guess is it worked
> > before because the Boost and std lib versions happened to be identical
> > by chance.
>
> My rule of thumb is to never ever do a "using namespace" in the global namespace in a header file,
or
> someplace prior to the point after all #includes in a cpp file. (And be wary of doing it even
then.)
>
> Strategic "using" or even "using namespace" from other namespaces can be useful, though.

+1

You may be able to get away with using namespace std globally, but doing this with Boost namespace
(or any other) is asking for trouble.

If it's not you, it may be some other unsuspecting and entirely innocent user - who will be even
more perplexed than you!

Avoid unnecessary program-miles, keep namespace declarations local :-)

Paul

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net