emacs-devel
[Top][All Lists]
Advanced

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

Re: bookkeeping to prepare for a 64-bit EMACS_INT on 32-bit hosts


From: Paul Eggert
Subject: Re: bookkeeping to prepare for a 64-bit EMACS_INT on 32-bit hosts
Date: Mon, 02 May 2011 12:23:40 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9

On 05/02/11 11:12, Stefan Monnier wrote:
> Given that
> 
>   #define checked_cast(t,x) ({ t v = (x); v})
> 
> can't be written in ISO C (AFAIK), I either form will be suboptimal,
> so there's no need to change the code.

How about the following idea instead?  Put this into lisp.h:

  static inline EMACS_INTPTR to_EMACS_INTPTR (EMACS_INTPTR a) { return a; }

Then, instead of this:

  EMACS_INTPTR ii = i;
  gpointer gi = (gpointer) ii;

(which is verbose) or this:

  gpointer gi = (gpointer) (EMACS_INTPTR) i;

(which misses some silly mistakes) we can write this:

  gpointer gi = (gpointer) to_EMACS_INTPTR (i);

(which has neither problem).



reply via email to

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