bitcoin-hivemind / hivemind

Knowledge Revolution
http://www.bitcoin-hivemind.com
MIT License
113 stars 6 forks source link

ato{f,i} functions are unsafe and deprecated #91

Open canndrew opened 7 years ago

canndrew commented 7 years ago

Replace their usage with toDouble/toInt

CryptAxe commented 7 years ago

atoi and atof are used so that we don't rely on Qt's conversions. I think it is worth having a conversation though as to whether we should use the newer c++11 functions:

http://en.cppreference.com/w/cpp/string/basic_string/stol http://en.cppreference.com/w/cpp/string/basic_string/stof

Once we make sure that it won't break anything all of the atoi and atof calls could be replaced with the equivalent c++11 functions.

canndrew commented 7 years ago

What's the motive for avoiding Qt's conversion functions? Keeping ato{f,i} would be a bad idea since they can be used to invoke undefined behaviour and there's lots of places where they're being fed unsanitized user input.

Are we currently pre-C++11 compatible and, if so, is that something we want to maintain?