|
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:
Hello, We still have troubles with the `(scm_t_int32) (x) < 0' test in `SCM_MAKE_CHAR ()': --8<---------------cut here---------------start------------->8--- address@hidden:~/guile-1.9.1/+build$ cat ,,t.c int 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. Ken
[Prev in Thread] | Current Thread | [Next in Thread] |