Boost logo

Boost :

Subject: Re: [boost] Help needed in fixing warnings
From: John Maddock (john_at_[hidden])
Date: 2009-11-09 04:32:17

>> Currently I have /W4 for msvc, and /Wall /Wextra -pedantic for gcc
>> listed on the wiki page.
> I thought the serialization library was "clean" until someone complained
> 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. It sort of an illustration
> how an idea with the the best of intentions leads to seems to
> lead to a host of unanticipated consequences. (Hmmm
> reminds me of current political events - maybe I watch to
> much TV).
> Bottom line, I'm stuck in a box.

Sigh... I forgot about that one: it's hit me before as well :-(

It seems that any implementation of non_copyable will inevitably generate
this warning with msvc - unless we rewrote it as a helper macro that you use
at class scope to define those private members - but that's hardly much help
either as it sort of defeats the whole "self documenting" purpose of
non_copyable. So I think the only solution is to use #pragma's in that
case: in case you're not familiar with them the usual incantation is:

#pragma warning(push)
#pragma warning(disable: number-list)
// Code goes here
#pragma warning(pop)

Where "number-list" is a whitespace separated list of all the warnings to

HTH, John.

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