Boost logo

Boost Users :

Subject: Re: [Boost-users] conflicting intmax_t definitions - Boost 1.53 and gcc 4.8 incompatibility?
From: Leon Mlakar (leon_at_[hidden])
Date: 2014-01-21 10:27:38


On 21/01/14 16:20, John M. Dlugosz wrote:
> On 1/20/2014 6:32 AM, Nate Finch wrote:
>> Yes, there are some using namespace boost statements, and some of
>> them are before some
>> includes... but why would that suddenly break when it was working
>> before I upgraded? Is
>> boost now defining its own intmax_t (and other such tings, like
>> uint64_t) where it wasn't
>> before?
>
> Because that's what 'using directives' ("using namespace XXX;") are
> for: to break builds by surprise and cause strange compatibility
> problems.
>
> Any change to the XXX namespace will change the symbols seen by the
> importer, and that may cause ambiguities (if you're lucky -- they are
> caught by the compiler) or unintended bizarre calls of the wrong
> function you didn't even know about (esp. when templates are involved).
>
> Don't dump somebody else's namespace into your work willy-nilly. If
> they are not maintained together, it's just wrong. Use using
> declarations for individual symbols, declaring just the ones you need
> (and are thus aware of).
>
Or alternatively avoid using "using" and use fully qualified names (e.g.
boost::intmax_t) - there's nothing wrong with this, either.

Leon


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