Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-07-29 11:47:09


On Fri, 28 Jul 2006 02:19:38 +0200, Gennaro Prota
<gennaro_prota_at_[hidden]> wrote:

>On Thu, 27 Jul 2006 14:23:31 -0500, Rene Rivera
><grafikrobot_at_[hidden]> wrote:
>
>>It's the false negatives that are worrisome. For example:
>>
>>const char * x = "//foo"; int x = min(10,20);
>>
>>Not that I think anyone would write such code. But strange things do
>>happen :-)
>
>Yep.

I have just committed a major update to the inspect tool. Besides some
fixes and improvements there's a *cautious* attempt to avoid false
positives with min/max invocations. Basically, if min and max appear
in a line beginning with "//" they are ignored, unless the presence of
a quote or of a "*/" sequence makes the case dubious (resolving such a
doubt would require scanning ahead/behind, to other lines, which is a
bit uneasy with the current code and probably overkill anyway). In
short, if you have something like:

 /*
  * This is a formula:
  *
  * result = min { X, Y }
  *
  ...
  */

it's enough to rewrite the min line as

 // * result = min { X, Y }

to avoid spurious "detections".

Changes have only been committed to the HEAD. All log messages (edit
summaries) belonging to this update begin with "Inspect Tool Update"
to ease future merge to the RC_1_34_0 branch. More changes may follow,
with the same edit summary convention.

--
[ Gennaro Prota, C++ developer for hire ]

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