emacs-devel
[Top][All Lists]
Advanced

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

Re: Intervals crash


From: David Kastrup
Subject: Re: Intervals crash
Date: Mon, 27 Sep 2010 11:02:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Jan Djärv <address@hidden>
>> Cc: address@hidden
>>
>> There are only 77 places where EMACS_UINT occurs in the Emacs
>> sources.
>
> 73, to be exact.  The rest are #define's and #ifndef's related to the
> definition of EMACS_UINT itself; they don't count.  #define XUINT
> should probably also be excluded, as it doesn't really "use"
> EMACS_UINT.
>
>>  Most of them are casts to and from pointers, and some are sizes
>> (like in Lisp_Vector).  It would not be a big job to get rid of them
>> if that is what we want.
>
> We can get rid of almost all of them, if we believe that size_t and
> EMACS_UINT are always of the same size.

Why wouldn't we be using size_t when we needed something of size size_t?

> I'm not sure we want to make that assumption, though, since lisp.h
> does allow for external definition of EMACS_UINT by some s/*.h or
> m/*.h file.
>
> In any case, I think we cannot get rid of using an unsigned data type
> in most of the 70+ places we do now, because of one or more of the
> following reasons:
>
>  . the value is a bit mask or a bit map

We have the assumption of two's complement arithmetic hardwired in a lot
of other places.  So bit operations should work on signed numbers
reasonably well.  Possible exception are right shifts when indeed the
full range of an EMACS_UINT over an EMACS_INT is being employed, but
then the number will not convert into an Elisp integer readily anyhow,
so why use EMACS_UINT at all?

>  . the value is a pointer that is subject to bitwise operations

Why would a pointer be put into an EMACS_UINT?

>  . the value is an unsigned data type forced by external hardware or
>    software API

Again, why an EMACS_UINT rather than the appropriate unsigned data type
forced by the external hardware?

If we use this as a Lisp integer, we won't be able to make use of the
full "unsigned" size.  If we don't use this as a Lisp integer, why use
EMACS_UINT in the first place?

-- 
David Kastrup




reply via email to

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