D
Digital Puer
I am seeing this very weird warning about
data type range. I am using g++ 4.1.2 (but this
applies to gcc as well).
I have this program:
#include <cstdio>
main()
{
char c = 27;
if (c >= 110 &&
c <= 127)
{
printf("hi");
}
}
When I compile it with g++, I get the warning:
test_range.cpp:7: warning: comparison is always true due to limited
range of data type
Line 7 is the comparison "c <= 127". Ok fine, that will always
be true, but the entire if-expression may not be true since
there is && in the expression.
Can someone tell me how to shut off this warning?
data type range. I am using g++ 4.1.2 (but this
applies to gcc as well).
I have this program:
#include <cstdio>
main()
{
char c = 27;
if (c >= 110 &&
c <= 127)
{
printf("hi");
}
}
When I compile it with g++, I get the warning:
test_range.cpp:7: warning: comparison is always true due to limited
range of data type
Line 7 is the comparison "c <= 127". Ok fine, that will always
be true, but the entire if-expression may not be true since
there is && in the expression.
Can someone tell me how to shut off this warning?