unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "carlo\.bramix" <carlo.bramix@libero.it>
To: "guile-devel" <guile-devel@gnu.org>
Subject: Re: `SCM_MAKE_CHAR ()' signedness issue
Date: Tue, 18 Aug 2009 20:39:54 +0200	[thread overview]
Message-ID: <KOL56I$1BE9E78A29EB87558849BA3C98CAD7C5@libero.it> (raw)

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/libguile/print.c:1108: warning: comparison is always true due to limited range of data type

But in this manner it seems ok:

#define SCM_MAKE_CHAR(x)                                               \
  (((scm_t_int32) (x) + 128) < 128                                     \
   ? SCM_MAKE_ITAG8 ((scm_t_bits) (unsigned char) (x), scm_tc8_char)   \
   : SCM_MAKE_ITAG8 ((scm_t_bits) (x), scm_tc8_char))

Sincerely,

Carlo Bramini.

---------- Initial Header -----------

From      : guile-devel-bounces+carlo.bramix=libero.it@gnu.org
To          : "Ludovic Courtès" ludo@gnu.org, guile-devel@gnu.org
Cc          :
Date      : Tue, 18 Aug 2009 10:32:29 -0700 (PDT)
Subject : Re: `SCM_MAKE_CHAR ()' signedness issue

> > From: Ludovic Courtès <ludo@gnu.org>
> > 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 modified to become
>
> 35 #define SCM_MAKE_CHAR(x)                                               \
> 36   (((x) < 128)                                               \
> 37    ? SCM_MAKE_ITAG8 ((scm_t_bits) (unsigned char) (x), scm_tc8_char)   \
> 38    : SCM_MAKE_ITAG8 ((scm_t_bits) (x), scm_tc8_char))
>
> Then hopefully that will solve all the build problems.
>
> > Thanks,
> > Ludo'.
>
> -Mike
>
>
>
>





             reply	other threads:[~2009-08-18 18:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18 18:39 carlo.bramix [this message]
2009-08-18 18:54 ` `SCM_MAKE_CHAR ()' signedness issue Mike Gran
2009-08-18 23:36   ` Greg Troxel
  -- strict thread matches above, loose matches on Subject: below --
2009-08-17 18:52 carlo.bramix
2009-08-17 19:41 ` Ken Raeburn
2009-08-15 12:00 Ludovic Courtès
2009-08-16 21:58 ` Ken Raeburn
2009-08-16 22:13   ` Ludovic Courtès
2009-08-16 22:25     ` Ken Raeburn
2009-08-17  8:26       ` Ludovic Courtès
2009-08-17 13:05         ` Mike Gran
2009-08-17 15:33           ` Ludovic Courtès
2009-08-18 17:32             ` Mike Gran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='KOL56I$1BE9E78A29EB87558849BA3C98CAD7C5@libero.it' \
    --to=carlo.bramix@libero.it \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).