C
Christopher Benson-Manica
int main()
{
bool foo=false;
for( unsigned int bar=0; bar < (foo?1:2); bar++ ) {
bar=42;
}
return 0;
}
A certain C++ compiler I am using claims that there exists in the
above code (on the line with the for loop) a comparison between a
signed and unsigned value. g++ invoked with strict options remains
silent. Is there any merit to the certain compiler's claim that
signed and unsigned values are being compared?
My guess is no, given that on
int main( void )
{
for( unsigned int bar=0; bar < (false?1:2); bar++ ) {
bar=42;
}
return 0;
}
the same compiler is silent.
{
bool foo=false;
for( unsigned int bar=0; bar < (foo?1:2); bar++ ) {
bar=42;
}
return 0;
}
A certain C++ compiler I am using claims that there exists in the
above code (on the line with the for loop) a comparison between a
signed and unsigned value. g++ invoked with strict options remains
silent. Is there any merit to the certain compiler's claim that
signed and unsigned values are being compared?
My guess is no, given that on
int main( void )
{
for( unsigned int bar=0; bar < (false?1:2); bar++ ) {
bar=42;
}
return 0;
}
the same compiler is silent.