
Gennaro Prota wrote:
Ah sure. Also "my" "/\*.*?\*/" doesn't match /* */ style comments which actually span multiple lines (:-O). But the intent wasn't to be as accurate as a parser. We were talking about "tweaking" the regexes a bit to avoid false positives.
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 :-)
In short we wanted them to be just more accurate than they are(n't) now.
OK. So you're saying we can make the comments conform to something the inspection program will understand?
If there's no danger to let violations go unnoticed with this, it seems still better than the current code. Example: this gives a false positive in boost/graph/maximum_cardinality_matching.hpp:
//[the Tutte-Berge] //formula guarantees that // // 2 * M(G) = min ( |V(G)| + |U| + o(G - U) ) // //where the minimum is taken over all subsets U of //V(G).
It wouldn't if we filtered out one-line comments. And if that were in a /* */ style comment, then simply adding "//" in front of the formula line would do the trick.
I guess you would have to be extremely careful, and especially limiting, with the regex to have some degree of confidence false negatives don't occur.
PS: did you read my suggestion about commit triggers?
I don't remember reading it. But I do remember that was suggested some time ago regarding inspection. I think I mentioned some problems with that back then ;-) -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo