Boost logo

Boost Users :

From: Sam Partington (sam.partington_at_[hidden])
Date: 2003-11-20 13:53:13

Bruce Johnston <mailto:c_kernel_at_[hidden]> wrote:
> I'm working on a project with strict requirements for the
> build settings,
> including mandatory warning level 4 and "treat warnings as errors". I
> discovered that lexical_cast causes warnings C4127, C4511,
> and C4512 when
> compiling with warning level 4 using VC7.1. Try the following
> code for a
> quick repro:

4511 and 4512 are useless warnings. They are telling you that the copy
constructor and assignment operator are inaccessible. Even though you're
not trying to call them. Take the following code

class noncopyable
        noncopyable(const noncopyable&);
        noncopyable& operator=(const noncopyable&);

class a_resource : noncopyable
// ...

// ...

        a_resource res;

Clearly a_resource is not meant to be copied, the developer has gone to
lengths to make that clear. Indeed it never is copied, or assigned, yet the
warnings will still be issued.

C4127 is also awkward. As it gives warnings for some common idioms. It
refers to conditional expressions being constant. So :

do { XXX } while(0);

Gives the warning, which is a common implementation of an ASSERT() macro,
and likewise

// in an header :

const bool debug = false;

// in code :

if (debug)

does also. None of these technigues indicate a possible error in code.
Ideally all three of these warnings would be disabled in config.hpp.

> As an aside, what warning level is typically used by
> developers working on
> Boost?

On VC6 we build on warning level 3, 4 is just too noisy with the built in

On VC7.1 we use level 4, but with C4127, C4511, C4512 switched off.



This e-mail has been sent from Imagination Technologies Limited. PowerVR, Metagence, Ensigma
and PURE Digital are divisions of Imagination Technologies Limited.

The information contained in this e-mail, including any attachment, is confidential and may be
legally privileged. It is intended solely for the addressee(s) and access to this e-mail by
anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying or
distribution or use of the information contained in this e-mail, is prohibited and may be unlawful.
If you have received this e-mail in error, please notify the sender by return e-mail and then
delete it from your system.

Internet communications cannot be guaranteed to be secure, error or virus-free. The sender does
not accept liability for any errors or omissions which arise as a result.

Any views expressed in this message are those of the author, except where the author specifies and,
with authority, states them to be the views of Imagination Technologies Ltd.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at