Re: [AD] C++ fix math

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Thu, 2002-08-08 at 15:33, Eric Botcazou wrote:
..
> 
> I'd rather mark the constructors as explicit:
> 
>    explicit fix(const int x)                          { v = itofix(x); }
>    explicit fix(const long x)                         { v = itofix(x); }
>    explicit fix(const unsigned int x)                 { v = itofix(x); }
>    explicit fix(const unsigned long x)                { v = itofix(x); }
>    explicit fix(const float x)                        { v = ftofix(x); }
>    explicit fix(const double x)                       { v = ftofix(x); }
> 
> Does anyone see a problem with this approach ?
> 

Heh, I didn't even know this keyword exists. But it seems like a good
solution to me - if someone forgets to include math.h, there will be a
warning now.

--
Elias Pschernig




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/