
On Sat, Aug 21, 2010 at 11:55 AM, Dave Abrahams <dave@boostpro.com> wrote:
Sent from my iPhone
On Aug 20, 2010, at 9:09 PM, Emil Dotchevski <emil@revergestudios.com> 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&. _______________________________________________
I agree with this Dave and I think it makes a good point, rather than pushing in casts to fix a warning, code in a manner that's intent is clear to the compiler. This is a much better solution (I think, at least in most circumstances) and would allow the removal of warnings and give us back the ability to use the warnings for what they are intended for (telling us the compiler is unsure of intent). Clean compiled code does give a feeling of satisfaction and unity with the intent IMHO.