Boost logo

Boost :

Subject: Re: [boost] [1.44][Serialization] fails to compile on OSX universal
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-08-21 14:23:48


On Sat, Aug 21, 2010 at 3:55 AM, Dave Abrahams <dave_at_[hidden]> wrote:
>
>
> Sent from my iPhone
>
> On Aug 20, 2010, at 9:09 PM, Emil Dotchevski <emil_at_[hidden]> wrote:
>
>> One option is to "fix" them anyway. Unfortunately, a lot of times this
>> involves casting, and in general I find it ill-advised to use a cast
>> to suppress a warning. Think about it: casts are used to tell the
>> compiler to do something it wouldn't normally do because it is
>> dangerous. This is true for all casts, including the ones people
>> sprinkle around to "fix" warnings.
>
> True, but you can often avoid those casts by allowing (presumably safer) implicit conversions to do the same work,e.g. instead of static_cast<Base&>(derived), declare and initialize a named Base&.

Yes, often is correct. :) The question is what to do with the other
instances, when you do need a cast or some other unwanted change in
the program. By unwanted, I mean a change you're making not because it
improves your code, but because it silences a particular warning on a
particular platform. Even if the code looks weird, most people just
add a comment that this weird thing they did is actually good, it
"fixes" a warning.

It would be interesting to know how many real problems are caused by
this and how much time is wasted chasing such warnings. It may turn
out that the potential danger many warnings protect against is
negligible in comparison.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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