cxxopts
cxxopts copied to clipboard
out of range argument not detected
An unsigned long long
parameter throws a cxxopts::argument_incorrect_type
when called with ULLONG_MAX + 1
as expected
terminate called after throwing an instance of 'cxxopts::argument_incorrect_type'
what(): Argument ‘18446744073709551616’ failed to parse
but cxxopts parses happily a much larger value 28446744073709551616
(ULLONG_MAX + 1e19)
incorrectly and sets the value of the parameter to 1e19 - 1
.
I feel like both of those values should be refused. Am I doing something wrong or is this a bug related to the internal working of cxxopts?
The first looks right, but the second sounds like a bug.
Not immediately related to this bug; however, while I have you here, I couldn't find a way to set limits to the parameters via cxxopts
. Is there a way to limit a numerical parameter to an arbitrary range or set of valid values without creating a custom class?