$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Yuval Ronen (ronen_yuval_at_[hidden])
Date: 2007-08-12 11:56:56
Andreas Huber wrote:
> Hi John
> 
> John Maddock <john <at> johnmaddock.co.uk> writes:
>>> #  pragma warning( disable: 4511 ) // copy constructor could not be
>>> generated #  pragma warning( disable: 4512 ) // assignment op could
>>> not be generated
>>>
>>> IMO, these warnings are not very useful. Users will get heaps of them
>>> when they employ the library, so disabling them permanently is a good
>>> thing.
>> I agree that they're useless, but I believe they'll still get suppressed for 
>> any instances of your templates that are instantiated if there is a matching 
>> #pragma warning(pop).
> 
> Correct. However, typical Statechart client code looks as follows:
> 
> #include <boost/statechart/simple_state.hpp>
> 
> struct MyMachine ....;
> struct MyState : sc::simple_state<MyState, MyMachine> { ... };
> 
> simple_state<> ultimately derives from noncopyable, which is why the warnings 
> are generated in the first place. Popping at the end of the header would 
> suppress the warnings for simple_state<> but would produce warnings for 
> MyState. Since I believe that *all* users who care about warnings will disable 
> these in their code anyway, I think the most user-friendly approach is to 
> permanently disable them in the library header.
I'm not sure these warnings are caused by derivation from noncopyable. I 
tried to compile
class A : private boost::noncopyable { };
in warning level 4 and got no warnings at all. I only get those 
4511/4512 warnings when I write a class with a data member (not base 
class) that is not CopyConstrucible/Assignable. I solve these warnings 
either by suppressing them, or by declaring the copy-c'tor/assignment-op 
as private, and with no body (private declaration only).