You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
argparse.hpp: In function ‘std::ostream& argparse::operator<<(std::ostream&, const Argument&)’:
argparse.hpp:686:53: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const std::__cxx11::basic_string<char>::size_type’ {aka ‘const long unsigned int’} [-Wsign-compare]
686 | while ((pos = argument.m_help.find('\n', prev)) != std::string::npos) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
This is because at line 680 auto pos is recognized as signed int instead of an unsigned type.
I recommend marking the values of pos and prev as unsigned or setting their type explicitly to size_t:
Forget that fix. After that -h and --help and automatic help messages don't work anymore. This might explain #242
I've changed it like this:
long pos = 0;
long prev = 0;
auto first_line = true;
auto hspace = ""; // minimal space between name and help message
stream << name_stream.str();
std::string_view help_view(argument.m_help);
while ((pos = argument.m_help.find('\n', prev)) != (long)std::string::npos) {
I get a warning about sign compare:
This is because at line 680
auto pos
is recognized as signed int instead of an unsigned type.I recommend marking the values of
pos
andprev
as unsigned or setting their type explicitly tosize_t
:See also the comments in this PR: #276 (comment)
The text was updated successfully, but these errors were encountered: