Boost logo

Boost :

Subject: Re: [boost] Formal Review: Boost.Polygon starts today August 24, 2009
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2009-08-31 12:49:53


2009/8/31 Simonson, Lucanus J <lucanus.j.simonson_at_[hidden]>:
> Phil Endecott wrote:
>> my 10 lines of code produce
>> 105 warnings that come to 54k of output.  This is with g++ 4.1.2.

with msvc-9 I get a lot of warnings from expressions like

    bool bit2 = atr_ & 4;
or
    bool bit2 = (bool)(atr_ & 4);

e.g.
boost\polygon\transform.hpp(256) : warning C4800: 'int' :
forcing value to bool 'true' or 'false' (performance warning)

A big amount of these can be silenced by the simple replacement

    bool bit2 = (atr_ & 4) != 0;

here is a regular expr for that.

\= *{[a-zA-Z][->.a-zA-Z_0-9]*} *{[&]} *{[1-9][0-9]*} *;
= (\1 \2 \3) != 0;

\= *\(bool\)({[a-zA-Z][->.a-zA-Z_0-9]*} *{[&]} *{[1-9][0-9]*} *);
= (\1 \2 \3) != 0;

HTH
Joachim


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