jamesdbrock / hffix

Financial Information Exchange Protocol C++ Library
http://jamesdbrock.github.io/hffix
Other
276 stars 89 forks source link

Lexical cast validation for hffix::message_reader #24

Open jamesdbrock opened 5 years ago

jamesdbrock commented 5 years ago

It would be nice if the hffix::details::atoi and hffix::details::atou functions verified that the ASCII which they are converting to a number is in fact digits 0-9.

But how to do that elegantly?

Don't want to complicate the return type with std::optional, that would require ugliness and C++17.

Don't want to throw an exception, the library design is that we only throw exceptions for mistakes in API usage, not for some garbage that we got over the network.