kastnermario / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

conversion of float node to integer works fine #117

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. run: int i; int success = Convert("1.245", i)
2. conversion is successful, returning 1

What is the expected output? What do you see instead?
conversion should fail.

atm, there is no clean way to distinguish between integer and floating-point 
nodes, since floats can be converted to integers without an error message. imo, 
this should be changed.

Original issue reported on code.google.com by tim.blec...@gmail.com on 30 Aug 2011 at 3:28

GoogleCodeExporter commented 8 years ago
I'm glad this issue has already been submitted. It was driving me mad. 
int->double throws exception but double->int silently floors without exception 
:(

Original comment by m...@riedel-privat.de on 20 Oct 2011 at 1:37

GoogleCodeExporter commented 8 years ago
Btw, int->double does of course not throw an exception. It was issue 125.

Original comment by m...@riedel-privat.de on 20 Oct 2011 at 6:55

GoogleCodeExporter commented 8 years ago
Fixed, rb5b43aa6509a, in both new/old APIs. Thanks!

Original comment by jbe...@gmail.com on 13 Jan 2012 at 5:53