Summary
It is possible to compare signed and unsigned values without issuing warnings, as demonstrated by the discussion thread in
1
, which suggests using size_t instead of an int or using an iterator to dodge the issue. The result in
2
also confirms that it is possible to determine whether warnings are issued when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned.
According to
See more results on Neeva
Summaries from the best pages on the web
Summary
Determines whether warnings are issued when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned.
Wsign-compare
ucl.ac.be
Summary
This discussion thread is about the warning settings for Caffe, which were previously set to -Wall, -Werror, -Wno-sign-compare, and -Wno-sign-compare. The author suggested using size_t instead of an int, which is closer to the return type of vector.size(), or using an iterator to dodge the issue. The discussion also highlighted the need for a pattern to fix and suppress sign-compare warnings, which are often overlooked in C++.
-Wno-sign-compare revisited and Caffe-as-Library · Issue #2216 · BVLC/caffe · GitHub
github.com
-Wno-sign-compare The compiler does not issue these warnings
Wsign-compare
intel.com
Some options take one or more arguments typically separated either by a space or by the equals sign (
gcc(1) - Linux manual page
man7.org