#1527 ParameterTree silently parses floating point values as int
Metadata
Property | Value |
---|---|
Reported by | Jö Fahlke (jorrit@jorrit.de) |
Reported at | Nov 7, 2014 13:06 |
Type | Bug Report |
Version | 2.3 |
Operating System | Unspecified / All |
Last edited by | Jö Fahlke (jorrit@jorrit.de) |
Last edited at | Nov 8, 2014 11:24 |
Closed by | Jö Fahlke (jorrit@jorrit.de) |
Closed at | Nov 8, 2014 11:24 |
Closed in version | Unknown |
Resolution | Fixed |
Comment |
Description
In a parameter tree of the form
setting = 0.5
the value of "setting" can be accessed as
int setting = ptree.get("setting");
This will set setting to 0, without any diagnostic.
I propose to issue an error (e.g. throw an exception) in get() when parts of the value cannot be parsed.
The version of get() with a default argument need some more research. It is clear that a string that cannot be parsed should not result in the default value, but in an error. It is however not clear what should happen if the option is set to a string containing only whitespace.
Liesel Schuhmacher (Münster) ran into this problem.