Subject: Re: archive.c/arm32
To: Patrick Welche <>
From: Chris G. Demetriou <>
List: current-users
Date: 03/23/1998 11:13:03
> Is anyone else seeing the warning in
> src/gnu/usr.bin/gcc/libobjc/archive.c
> In function `__objc_code_char':
>   96: warning: comparison is always 1 due to limited range of data type
> ?!
> static __inline__ int
> __objc_code_char (unsigned char* buf, char val)
> { 
>   if (val >= 0)

"Known problem."

val is a char, chars are unsigned on the arm32.  therefore, "val >= 0"
is always going to be true.

My current way of working around that is to change that 'if' to check:

	((int)val & 0x100) == 0

(if 'val' is signed and negative, it'll be sign-extended, so bits
above the low 8 will be set.  otherwise those bits will be zero.)

Does anybody know enough about Objective C's 'char' semantics to know
if that's the right thing to do?  (In particular, is the signedness of
'char' in Objective C implementation defined, like it is in ANSI?  If
so, then that check should be OK.)