emacs-devel
[Top][All Lists]
Advanced

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

Re: EMACS_INT cleanup


From: Eli Zaretskii
Subject: Re: EMACS_INT cleanup
Date: Thu, 23 Sep 2010 22:40:53 +0200

> From: Lars Magne Ingebrigtsen <address@hidden>
> Date: Thu, 23 Sep 2010 22:29:49 +0200
> 
> Eli Zaretskii <address@hidden> writes:
> 
> >> A cast somewhere in the macro would probably do the trick, but
> >> where?
> >
> > Does it help to make sa_count's type ptrdiff_t instead of int?
> 
> I just added the (int) here, which seemed to do the trick:
> 
> #define USE_SAFE_ALLOCA                       \
>   int sa_count = (int) SPECPDL_INDEX (), sa_must_free = 0

If ptrdiff_t works, it is a better solution, because SPECPDL_INDEX is
defined like this:

    extern struct specbinding *specpdl;
    extern struct specbinding *specpdl_ptr;
    ...
    #define SPECPDL_INDEX()     (specpdl_ptr - specpdl)

So it returns a difference between two pointers, which is exactly what
ptrdiff_t is for (as its name hints).

Casting it to an int will DTWT on a 64-bit host.

sa_must_free can stay an int, btw.



reply via email to

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