guile-devel
[Top][All Lists]
Advanced

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

Re: Portability problem with SCM_DEBUG_TYPING_STRICTNESS=1


From: Michael Livshin
Subject: Re: Portability problem with SCM_DEBUG_TYPING_STRICTNESS=1
Date: 08 Jun 2001 13:13:31 +0300
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Copyleft)

Matthias Koeppe <address@hidden> writes:

> And, finally, in num2integral.i.c when included for ptrdiff_t:
> 
> "../libguile/num2integral.i.c", line 26: warning: integer overflow detected: 
> op "<<"
> "../libguile/num2integral.i.c", line 26: warning: integer overflow detected: 
> op "<<"
> "../libguile/num2integral.i.c", line 45: warning: integer overflow detected: 
> op "<<"
> "../libguile/num2integral.i.c", line 123: warning: integer overflow detected: 
> op "<<"
> 
> But this only caused by the dirty way PTRDIFF_MIN is computed.  The
> following patch helps to avoid the warning; but it's not much cleaner,
> of course:
> 
> Index: numbers.c
> ===================================================================
> RCS file: /cvs/guile/guile-core/libguile/numbers.c,v
> retrieving revision 1.132
> diff -u -u -r1.132 numbers.c
> --- numbers.c 2001/06/07 21:12:19     1.132
> +++ numbers.c 2001/06/08 09:03:11
> @@ -4202,7 +4202,7 @@
> 
>  #define SIZE_MAX ((size_t) (-1))
>  /* the below is not really guaranteed to work (I think), but probably does: 
> */
> -#define PTRDIFF_MIN ((ptrdiff_t) ((ptrdiff_t)1 << (sizeof (ptrdiff_t) * 8 - 
> 1)))
> +#define PTRDIFF_MIN ((ptrdiff_t) ((size_t)1 << (sizeof (ptrdiff_t) * 8 - 1)))
>  #define PTRDIFF_MAX (~ PTRDIFF_MIN)
> 
>  #define NUM2INTEGRAL scm_num2short

hrm...  I'd rather leave this as is for now.  would it be too much to
ask you to check whether it works right despite the warning?
(i.e. that PTRDIFF_MIN == LONG_MIN).

-- 
All ITS machines now have hardware for a new machine instruction --
SETS
Set to Self.
Please update your programs.




reply via email to

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