I'm integrating this fantastic library into a larger project (https://gdal.org) that has a CI configuration building with clang's -fsanitize=unsigned-integer-overflow mode, and it currently halts in a few places of argparse. This is apparently due to the std::map<> methods using unsigned integer overflow when they key is a std::string_view, at least with clang 10 on Ubuntu 20.04. Unsigned integer overflow is well defined behavior in C/C++, but I tend to think it is preferable to avoid it to be able to detect real bugs where the overflow is not desired. With those changes, argparse unit test now run fine with -fsanitize=unsigned-integer-overflow
I also find it quite fragile to use a std::string_view as the key of a map. This assumes that the key has a lifetime greater or equal to the instance of argparse (I actually got bitten by this in a customization of argparse, where I didn't realize I couldn't use an ephemeral string)
I'm integrating this fantastic library into a larger project (https://gdal.org) that has a CI configuration building with clang's
-fsanitize=unsigned-integer-overflow
mode, and it currently halts in a few places of argparse. This is apparently due to the std::map<> methods using unsigned integer overflow when they key is a std::string_view, at least with clang 10 on Ubuntu 20.04. Unsigned integer overflow is well defined behavior in C/C++, but I tend to think it is preferable to avoid it to be able to detect real bugs where the overflow is not desired. With those changes, argparse unit test now run fine with-fsanitize=unsigned-integer-overflow
I also find it quite fragile to use a std::string_view as the key of a map. This assumes that the key has a lifetime greater or equal to the instance of argparse (I actually got bitten by this in a customization of argparse, where I didn't realize I couldn't use an ephemeral string)