Mail Archives: djgpp/1997/10/27/17:00:30
Roman Suzi schrieb:
> Hi, all!
>
> I have encountered a problem with porting a program
> from BC++ 3.1 to gnu c++ (from DJGPP 2.01 package).
>
> The problem is best seen in this example of code:
> --------------------------------------------------
> unsigned char a;
>
> a = 253;
>
> if (a=='\xFD') {
> ...
> };
> --------------------------------------------------
>
> Compiler gives warning, that
> "comparison is always 0 due to limited range of data type"
Using exactly this code, the compiler should give you the warning
"multi-character character constant" because of "'\xFD'".
'\xFD' represented as a number is 796411460, which can never be represented
with an unsigned char.
I assume you wanted to write " if (a==0xFD) {...} /* no ; here */ "
where 0xFD is hex representation of 253 decimal
>
>
> There were nothing of the sort in BC.
>
> When I use signed char a, the warning
> disappears
Very strange...
- Raw text -