|
Boost : |
From: Deane Yang (deane_yang_at_[hidden])
Date: 2004-01-03 22:44:24
Andy Little wrote:
> explicit if overused is just another implicit
> static_cast, dynamic_cast etc provide a better more diverse precursor for
> conversions.
> name over structure seems to work better in template coding... it can
> provide a more explicit contract
>
Any chance you could elaborate on this? I apologize if I'm wrong,
but I think you might have written this while you were bouncing
a baby on your lap.
I find myself automatically making any eligible constructor explicit
and removing it later only in a few rare circumstances. But I also
almost never use default arguments anymore, either. I just like
everything to be staring me in the face, when I'm trying to fix my
code or just trying to remember what code I wrote more than week ago
does. And the compiler warns me if I accidentally do a cast that I
didn't mean to.
I also wish it were possible to turn off all those automatic conversions
like from int to double, too. It definitely causes me more grief
than gain. Unfortunately, you can't even turn on the warnings about
these conversions, because you get a gazillion warnings from the
C and C++ library code.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk