J
John Ratliff
"comparison is always false due to limited range of data type"
I get this warning with g++ when I compile some code and I'm not quite
sure I understand it.
I have a small file that I've read into a memory buffer. It is defined
char sram[0x2000];
I need to check for a specific value within this buffer.
However, when I do
if (sram[36] == 0xC8) {
// blah blah
}
I get the warning.
What specifically is wrong with this? Is it a signedness issue? When I
use static_cast<unsigned char>(sram[36]) instead, I stop getting the
warning. Is this a correct solution, or am I simply silencing the error
without fixing the problem?
Thanks,
--John Ratliff
I get this warning with g++ when I compile some code and I'm not quite
sure I understand it.
I have a small file that I've read into a memory buffer. It is defined
char sram[0x2000];
I need to check for a specific value within this buffer.
However, when I do
if (sram[36] == 0xC8) {
// blah blah
}
I get the warning.
What specifically is wrong with this? Is it a signedness issue? When I
use static_cast<unsigned char>(sram[36]) instead, I stop getting the
warning. Is this a correct solution, or am I simply silencing the error
without fixing the problem?
Thanks,
--John Ratliff