Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string_to_integer(const char_t* value, U minneg, U maxpos) clips values, does not throw to indicate out-of-bounds error. #86

Closed
hallsoftware opened this issue Feb 9, 2016 · 1 comment

Comments

@hallsoftware
Copy link

When parsing XML files, string_to_integer(...) clips invalid values to max or min values and does not indicate that invalid values are found. I would prefer that this function throws some out-of-bounds exception.

@zeux zeux added the duplicate label Feb 9, 2016
@zeux
Copy link
Owner

zeux commented Feb 9, 2016

This is consistent with the previous behavior (when using strtoll etc.). Of course indicating an error is better.

While throwing an exception is not a good idea (pugixml does not use exceptions for the most part, xpath_exception being the only unfortunate... uh... exception), especially at this stage where it would throw for callers that do not anticipate it, there are potential alternatives.

Improvements to handling issues like this are tracked in #15.

@zeux zeux closed this as completed Feb 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants