emacs-devel
[Top][All Lists]
Advanced

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

Re: Preventing warnings in FIXNUM_OVERFLOW_P


From: Eli Zaretskii
Subject: Re: Preventing warnings in FIXNUM_OVERFLOW_P
Date: Thu, 18 Jan 2007 23:49:44 +0200

> From: Richard Stallman <address@hidden>
> Date: Thu, 18 Jan 2007 12:27:57 -0500
> 
> Ian Lance Taylor <address@hidden> wrote:
> 
>     You can avoid it by using unsigned types.  I think that something like
>     this will do the trick:
> 
>     #define FIXNUM_OVERFLOW_P(i)                                      \
>       ((unsigned long long)(i) > MOST_POSITIVE_FIXNUM         \
>        && (unsigned long long)(i) < MOST_NEGATIVE_FIXNUM)
> 
> Would someone please give that approach a try and see if it works?

It seems to work.

> I am having too much trouble with concentration right now to see
> whether that code is correct

Which is precisely the problem with this solution: it is no longer
clear that the code does what we want, since mixing signed with
unsigned produces confusing code and is generally asking for trouble.

And then there's what David said about long long: if we use the above,
we will need to have two versions of the macro: one for GCC, the other
for other compilers.

So on balance, I think this solution is worse than my workaround.

It sounds like GCC maintainers are working on fixing this in a future
version.  So I'd suggest to leave this alone until then.




reply via email to

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