[SLUG] C Programmer problem

2000-12-04 Thread Ken Foskey
Here is one for people to scratch their head on: unsigned char ucObject[255]; memset(ucPrtLine,0,sizeof(ucPrtLine)); sfb = fiInp-afpRec.sfbPtr; memset(ucObject,0,sizeof(ucObject)); strcpy((PCHAR) ucObject,(PCHAR) fiInp-ucOName); if (ucObject[0] == '\xff') {

Re: [SLUG] C Programmer problem

2000-12-04 Thread John Clarke
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 0x.