Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-18 03:40:46


"Jeff Garland" <jeff_at_[hidden]> writes:

> On Mon, 17 Nov 2003 20:09:19 -0500, Beman Dawes wrote
>
>> You've already given examples of "perfectly good code" that gets
>> flagged with that warning. I'd say that makes the shadow warning a
>> non-starter for Boost.
>
> I don't think it's that easy to discount -Wshadow. The following is perfectly
> legal code, but probably not what you were trying to do. -Wshadow points out
> a very hard to find bug immediately.
>
> void foo(int& bar)
> {
> if (bar > 10) {
> int bar = 20; //oops didn't mean to declare a local here...
> }
> }
>
> Obviously this issue goes way beyond -Wshadow. I've recently spent some time
> cleaning up issues in date-time with Level 4 warnings for VC. I have yet to
> see a level 4 warning from VC that prevented a bug in my code, but I spent the
> time because I respect that users want to compile with warning levels cranked up.

You didn't need to spend that much time, though: VC warnings can be
selectively disarmed with #pragmas.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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