[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XMLhelper::parse_bool needed?
From: |
Neil Hotmail |
Subject: |
Re: XMLhelper::parse_bool needed? |
Date: |
Fri, 11 Oct 2002 23:15:58 +0100 |
Basically VC++ returns an error if you automatically cooerce a float or an
int to a bool. I have no idea what the XML::parse functions do, but I
guessed at take a string (or XML node with a string in it) and return a
bool/float/int, if the code wants a bool it makes more sense to me to call
parse_bool than parse_float, parse_int makes some basic sense (as int's and
bool's are fairly interchangeable), but float's can't even represent 0 (the
only false value) accurately, so using them in some invisible middle step on
a conversion to bool seems wrong.
If this is intentional then a static_cast<bool> should really be added, to
make this clear (and remove VC warnings), but it still seems wrong to me.
I have now patched every other VC warning apart from this one, so once this
is sorted one way or another I'll let you have the patch.
Ginge
--------------------
On Friday 11 October 2002 21:05, Neil Hotmail wrote:
> stretch_x is a bool, but parse_float returns a float, is this intentional?
I'd guess so, see below.
> Would it not make more sense to use parse_int as this is (or should be) a
> simpler and quicker function, and integers are quicker than floats.
Assume a simple 0.03f - true if converted from float, false if converted
from
int regardless of wheter the parsing continues at the decimal point or not -
it'd get rounded down to 0 aka false.
> Another alternative would be to add a specific parse_bool statement.
What should this one parse and how?
Bye David
_______________________________________________
Pingus-Devel mailing list
address@hidden
http://mail.freesoftware.fsf.org/mailman/listinfo/pingus-devel
- Bugs on Savannah, Gervase Lam, 2002/10/09
- Re: Bugs on Savannah, Gervase Lam, 2002/10/10
- Re: Bugs on Savannah, Gervase Lam, 2002/10/11
- Intentional code?, Neil Hotmail, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11
- Re: Intentional code?, Neil Hotmail, 2002/10/11
- XMLhelper::parse_bool needed?, Neil Hotmail, 2002/10/11
- Re: XMLhelper::parse_bool needed?, David Philippi, 2002/10/11
- Re: XMLhelper::parse_bool needed?,
Neil Hotmail <=
- Re: XMLhelper::parse_bool needed?, Ingo Ruhnke, 2002/10/11
- Re: Intentional code?, Neil Hotmail, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11
- Re: Intentional code?, Ingo Ruhnke, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11
- Re: Intentional code?, David Philippi, 2002/10/11