It is possible to compare signed and unsigned values without issuing warnings, as demonstrated by the discussion thread in
, which suggests using size_t instead of an int or using an iterator to dodge the issue. The result in
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.
See more results on Neeva
Summaries from the best pages on the web
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.
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
-Wno-sign-compare The compiler does not issue these warnings
Some options take one or more arguments typically separated either by a space or by the equals sign (
gcc(1) - Linux manual page