From: Andreas Huber (ahd6974-spamboostorgtrap_at_[hidden])
Date: 2007-08-11 11:30:11
"Michael Marcin" <mmarcin_at_[hidden]> wrote in message
>> # pragma warning( disable: 4511 ) // copy constructor could not be
>> # pragma warning( disable: 4512 ) // assignment op could not be
>> 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.
> Thats what I thought until recently I noticed that I had 4 similar
> functor classes and I was getting this warning in only 1 of them. Turns
> out I forgotten to make some member pointers const (I only made the
> pointed to data const). Fixing this actually ended up generating better
> code on another compiler (the one for the shipping platform) in a
> performance critical area.
I'd say you just got lucky as the flaws you've found have little to do with
the intent of the warnings. For the vast majority of code these warnings can
safely be ignored, because your code will simply refuse to compile, should
you ever try to use one of the functions the compiler failed to generate.
Other compiler vendors seem to agree (by not adding such warnings to their
compiler). So, for most users these warnings are just a nuisance, turning
them back on at the end of the header would cause more grief than not doing
> I don't think libraries should force such decisions on end users. If you
> have evaluated your code and made sure it is doing the right thing than
> disable the push the warning disable but restore it so that users might
> catch problems in their code.
See above, your finding of flaws with these warnings is not exactly common.
> Anything else is rude.
The code is open to your inspection and the permanent suppressions can be
found very easily as Steven has shown. If you really do care so much about
these warnings then turn them back on after including the headers. This
approach is more work for you, but makes live easier for the vast majority
-- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk