Boost logo

Boost :

Subject: Re: [boost] [new Warnings policy] MS C4180 on the Maintenance Guidelines
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-11-18 10:25:12


On Mon, Nov 16, 2009 at 3:08 PM, Patrick Horgan <phorgan1_at_[hidden]> wrote:

>
>
> Wonderful!
>
> C4180 Surely instead of suggesting suppressing you would remove the
> meaningless qualifier?

  C4996 Microsoft deprecated these functions on their own (and they call
> themselves POSIX compliant), and replaced them with extremely dangerous
> replacements that they claim are safe. The replacement functions are
> non-POSIX and aren't available from other compilers, hence non-portable.
> These warnings should be suppressed. I believe that you can also
> suppress
> by defining _CRT_NONSTDC_NO_DEPRECATE before and undef'ing after to do a
> local suppression.
>
Somewhat off topic, but why exactly are these extremely dangerous, and not
secure?

> C4800 Might suggest that they use a bool valued expression in the first
> place, i.e. instead of foo, foo!=0, or do a static cast to bool. This is
> at
> times indicative of real bugs, when people turn out to not be doing what
> they thought they were doing. Apparently this is one of my favorite bugs
> (by favorite I don't mean that I like it either!)
> C4506 Might suggest that they provide the definition;)
> Someone had mentioned a redesign of boost:noncopyable to work around the
> C4511 and C4512 warnings from deriving from boost:noncopyable. Is anyone
> looking into it? Is it even possible? It's a shame that this wonderful
> thing generates so much noise. If course, if you want to make a class
> uncopyable, rather than inheriting from boost:uncopyable, you could just
> make your own copy and assignment declarations privately and without
> definitions if you don't need them. It makes the class non-copyable
> without
> generating the warnings. If you have other causes of C451{0-2} see
> below:
> C4510/C4511/C4512 In general if you provide one of destructor, assignment
> operator, and copy constructor, then you need all three. The best fix is
> to
> provide the method. Providing a private declaration is a way of telling
> the
> compiler that you are sure your case is different--if it really is.
> These
> are all caused by either inaccessible base class version, or const or
> reference data members.
> Similar to 4511 and 4512 are the following which occur on trying to
> derive
> from a non-copyable class, i.e. one with the preceding issues--you will
> also
> get 4511 and 4512.
>
Beman proposed changing noncopyable idiom to a macro. This would solve not
only the
warning problems but also the problem of horrible compiler error messages
that results
from the current idiom. I would welcome this change. Then we could mark
the boost::noncopyable
class as deprecated

Zach


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk