Here are two cases when a Warning #186 is displayed:
// Case 1:
for( RTuint t = 0; t < ( ( RTuint )NUMBER_OF_TESTS - 1 ); t++ )
Note 1: 'RTuint t = 0' is not a comparison with 0. It is assignment of 0 to the variable 't'.
// Case 2:
if( pIoParams->uiEOLBytes >= 0 && pIoParams->uiEOLBytes <= 2 )
Note 2: The 'if' statement verifies that 'pIoParams->uiEOLBytes' is in a range from 0 to 2 and
valid values are as follows: 0, 1, or 2.
A processing is not allowed if the value of 'pIoParams->uiEOLBytes' is outside of the range.
A word 'pointless' seems to me too "harsh" because I really know what I need to verify and a more neutral message
will look significantly better, like:
Warning #186: possibly unnecessary comparison of unsigned integer with zero
and please consider this.
My Development Environment:
OS: Windows XP 32-bit
IDE: Visual Studio 2005 SP1
Compilers: Intel C++ / Microsoft C++ / Borland C++ / MinGW / Turbo C++
Intel C++ compiler version ( Composer XE 2011 Update 9 ):
Intel C++ Compiler XE 126.96.36.1990 [IA-32]
Intel C++ compiler command line options:
/c /Od /D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "_VC80_UPGRADE=0x0710"
/D "_UNICODE" /D "UNICODE" /GF /EHsc /RTC1 /MTd /GS /fp:precise /W5 /nologo /ZI /TP
Are you sure you're seeing the carat appearing in the right place? Here's my code which I based on yours:
No. Could youdo a very quick verification with:
const int NUMBER_OF_TESTS = 1024;
and please set a 'Tahoma' font (size 8 ) for a Visual Studio's Output Window.