Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-18 Thread Greg Troxel
I think the problem is that the routine in question is fundamentally written to assume a signed input. Perhaps there should be an unsigned version that takes unsigned chars, and perhaps guile should explicit declare characters as one or the other. Or perhaps just always cast to unsigned char - i

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-18 Thread Mike Gran
> From: carlo.bramix > > Hello, > unfortunately that code still fails into libguile/print.c > Infact, a signed char just arrives to 127 and the " < 128" causes: > > ../../guile-git/libguile/print.c:1101: warning: comparison is always true due > to > limited range of data type > ../../guile-git

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-18 Thread carlo.bramix
Date : Tue, 18 Aug 2009 10:32:29 -0700 (PDT) Subject : Re: `SCM_MAKE_CHAR ()' signedness issue > > From: Ludovic Courtès > > To: guile-devel@gnu.org > > Sent: Monday, August 17, 2009 8:33:03 AM > > Subject: Re: `SCM_MAKE_CHAR ()' signedness issue > >

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-18 Thread Mike Gran
> From: Ludovic Courtès > To: guile-devel@gnu.org > Sent: Monday, August 17, 2009 8:33:03 AM > Subject: Re: `SCM_MAKE_CHAR ()' signedness issue > > I'm fairly confident that for such a small piece of code inlining is > always a good idea. OK.  If the comparison is

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-17 Thread Ken Raeburn
On Aug 17, 2009, at 14:52, carlo.bramix wrote: Hello, if I understood the problem, I think it can be easily fixed without using an inline function. For example: #ifdef __GNUC__ Relying on GCC-specific syntax is probably worse than an inline function. Part of Ludovic's complaint was that

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-17 Thread carlo.bramix
itten. Sincerely, Carlo Bramini. -- Initial Header --- >From : guile-devel-bounces+carlo.bramix=libero...@gnu.org To : guile-devel@gnu.org Cc : Date : Mon, 17 Aug 2009 17:33:03 +0200 Subject : Re: `SCM_MAKE_CHAR ()' signedness issue > Mike Gran

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-17 Thread Ludovic Courtès
Mike Gran writes: > On my system I ran a test with SCM_MAKE_CHAR as a macro, an an inline, > and as a never inlined function. I ran ./check-guile twice for each. You're cheating! ;-) The test suite does lots of things besides calling `SCM_MAKE_CHAR ()', so I'm not sure if it's a good benchmar

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-17 Thread Mike Gran
Hi- On Mon, 2009-08-17 at 10:26 +0200, Ludovic Courtès wrote: > Hi, > > Ken Raeburn writes: > > > On Aug 16, 2009, at 18:13, Ludovic Courtès wrote: > >>> There's always the inline-function approach, too. > >> > >> Unfortunately no, because we're still not assuming `inline' keyword > >> support

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-17 Thread Ludovic Courtès
Hi, Ken Raeburn writes: > On Aug 16, 2009, at 18:13, Ludovic Courtès wrote: >>> There's always the inline-function approach, too. >> >> Unfortunately no, because we're still not assuming `inline' keyword >> support from the compiler. > > Right, but inline.h deals with that; if "inline" isn't sup

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-16 Thread Ken Raeburn
On Aug 16, 2009, at 18:13, Ludovic Courtès wrote: There's always the inline-function approach, too. Unfortunately no, because we're still not assuming `inline' keyword support from the compiler. Right, but inline.h deals with that; if "inline" isn't supported you just get a declaration and

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-16 Thread Ludovic Courtès
Ken Raeburn writes: > 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. Oh, good point. > There's always the inline-function approach, too. Unfortunately no, because

Re: `SCM_MAKE_CHAR ()' signedness issue

2009-08-16 Thread Ken Raeburn
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--- l...@gcc54:~/guile-1.9.1/+build$ cat ,,t.c int foo (unsigned char x) { return (((int)x)

`SCM_MAKE_CHAR ()' signedness issue

2009-08-15 Thread Ludovic Courtès
Hello, We still have troubles with the `(scm_t_int32) (x) < 0' test in `SCM_MAKE_CHAR ()': --8<---cut here---start->8--- l...@gcc54:~/guile-1.9.1/+build$ cat ,,t.c int foo (unsigned char x) { return (((int)x) < 0 ? 1 : -1); } l...@gcc54:~/guile-1.9.1/+build$