Boost logo

Boost :

Subject: Re: [boost] Help needed in fixing warnings
From: John Maddock (john_at_[hidden])
Date: 2009-11-10 04:58:48

>> While not as easy for you as some yet undiscovered change to
>> noncopyable, can't you just use the MSVC pragma warning dance around
>> your classes to quiet that warning in each case?
> I could, and I might but....
> To my mind this is an invalid warning. The code in question is not
> incorrect
> and the boost::noncopyable provides the protection against the situation
> that the warning is designed to detect. So from my perspective the
> best would be to add /wd4511 and /wd4512 to the compiler switches.
> Of course that's not really a good solution because other code might
> not have the boost non_copyable protection. Ideally the compiler
> would be able detect that the copy/assigment functions can't be
> used in this case any way. Or maybe the compiler needs some sort
> of class attribute.

Nod. I think this is a common issue: the warning is entirely bogus in this
case, but in other contexts users may find it genuinely useful. The
question is whether we can silence the "noise" to a level that allows the
user to turn on a higher level of warnings and get useful output from their
code only. In this case yes, I believe we can.

> in the meantime...
> Of course I can conditionaly include pragma for this compiler.
> The problem is that you start have to doing for all compilers
> and they've all got their own set of quirks. This makes the
> code harder to read, understand and maintain. You HAVE
> to do it sometimes to work around bogus compiler errors
> but I'm sort of reluctant to embark upon this to work around
> bogus compiler warnings. This raises the question about how
> to handle the "warning" that such and such a function has been
> "deprecated" when it actually hasn't and of course those
> warnings which are just hints that sometimes have to be
> knowingly violated.
> Basically, once you start considering this - it sort of
> takes on a life of its own.

Nod. I don't think anyone is suggesting that all of boost be warning free
with all possible compilers, that just wouldn't be possible IMO. But does
that mean that we shouldn't try to do better with the most popular tools?

Not a rhetorical question, just feeling my way yours.... John.

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