[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `SCM_MAKE_CHAR ()' signedness issue

From: Ken Raeburn
Subject: Re: `SCM_MAKE_CHAR ()' signedness issue
Date: Sun, 16 Aug 2009 17:58:25 -0400

On Aug 15, 2009, at 08:00, Ludovic Courtès wrote:

We still have troubles with the `(scm_t_int32) (x) < 0' test in

--8<---------------cut here---------------start------------->8---
address@hidden:~/guile-1.9.1/+build$ cat ,,t.c
foo (unsigned char x)
 return (((int)x) < 0 ? 1 : -1);
address@hidden:~/guile-1.9.1/+build$ gcc -Wall -c ,,t.c
,,t.c: In function ‘foo’:
,,t.c:4: warning: comparison is always false due to limited range of data type

In the case of SCM_MAKE_CHAR, both actions give identical results for an input of 0, so I think just testing "x <= 0" will silence the warning without changing the behavior.

There's always the inline-function approach, too.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]