On Tue, Dec 05, 2000 at 08:57:44AM +1100, Ken Foskey wrote:

> a)  'x\ff' is implicitly an integer.

No, it's a char, but promoted to int for the comparison. Since char is
a signed type, the value is sign-extended during the conversion, and
hence you're actually comparing against 0xffffffff.  ucObject[0] can
never be negative, so the comparison will always fail.

> b)  unsigned char is implicitly promoted to int and 0xff is a valid
> value.

But '\xff' is not an unsigned char.  It's char.  -funsigned-char makes
it work by causing unsigned conversion to int.  If you really want to
use unsigned char for strings, then use (unsigned char)'\xff' or simply
0xff.  Or you could simply use char and remove all those type casts to
PCHAR.


Cheers,

John
-- 
whois [EMAIL PROTECTED]


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to