Subject: Re: [boost] Help needed in fixing warnings
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-11-09 15:39:38
Stewart, Robert wrote:
> Robert Ramey wrote:
>> I thought the serialization library was "clean" until someone
>> that there were warnings at level 4. When I investigated, I found
>> that the major complaint was that that I had "const" members
>> so the compiler couldn't generate copy/assigment functions.
>> It turns out that these classes used the boost::noncopyable
>> facility. So to eliminate these warnings this facility needs
>> to be re-implemented in a different way.
> 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
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.
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
Basically, once you start considering this - it sort of
takes on a life of its own.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk