[Top][All Lists]

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

Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?

From: Andreas Schwab
Subject: Re: macro FIXNUM_OVERFLOW_P in lisp.h is valid ?
Date: Sat, 24 Oct 2009 11:40:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Stefan Monnier <address@hidden>
>> Date: Fri, 23 Oct 2009 21:05:05 -0400
>> Cc: address@hidden, Andreas Schwab <address@hidden>,
>>      address@hidden
>> Actually, when the cast was added in 2001, it came with the following
>> commit-log-comment:
>>   (FIXNUM_OVERFLOW_P): Cast I to EMACS_INT in comparisons
>>   in case I is of some unsigned type, in which case
>>   MOST_NEGATIVE_FIXNUM will be converted to unsigned, and the
>>   comparison becomes bogus.
> Right, sorry for my failing memory.
> So I think the change made yesterday by Andreas should be reverted.

The cast does not really fix the described problem anyway.  Converting
an unsigned value to a signed type when the value is out of range for
the signed type results in an implementation defined value.  That is
less bad than undefined behaviour, but still not portable.


Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

reply via email to

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