-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
Allow INIReader to read 64-bit integers #151
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. I'm happy to add these, however, one small comment about the test value, and a couple of questions about naming and types.
INIReader::GetBigInteger
and INIReader::GetBigUnsigned
Fixed-width type definitions were already accessible with `<map>` included, but it's nice to include this header anyways.
cpp/INIReader.h
Outdated
INI_API unsigned long GetUnsigned(const std::string& section, const std::string& name, unsigned long default_value) const; | ||
|
||
// Get an unsigned 64-bit integer (uint64_t) value from INI file, returning default_value if | ||
// not found or not a valid unsigned integer (decimal "1234", "-1234", or hex "0x4d2"). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the "-1234" example here, as it's incorrect for unsigned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now! Requesting one very minor change to remove the "-1234" example from GetUnsigned64.
Thanks for your contribution. Just tagged release r57. |
Awesome! Glad I could contribute. |
In some cases, it may be desired to read (unsigned) integer values outside of the 32-bit bounds. In 32-bit code, however, this might not be the case since doing so by default would cost performance. Rather than changing the types delivered by
INIReader::GetInteger
andINIReader::GetUnsigned
, a good way to accommodate is to add separate methods capable of reading (unsigned) 64-bit integers.