unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: Intervals crash
Date: Mon, 27 Sep 2010 11:02:02 +0200	[thread overview]
Message-ID: <87y6anblv9.fsf@lola.goethe.zz> (raw)
In-Reply-To: E1P09AB-0003Fz-6Q@fencepost.gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Jan Djärv <jan.h.d@swipnet.se>
>> Cc: emacs-devel@gnu.org
>>
>> 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	other threads:[~2010-09-27  9:02 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 18:23 Intervals crash Chong Yidong
2010-09-23 18:52 ` Chong Yidong
2010-09-23 19:01   ` Eli Zaretskii
2010-09-23 19:09     ` Chong Yidong
2010-09-23 19:32       ` Eli Zaretskii
2010-09-23 18:57 ` Eli Zaretskii
2010-09-24  6:12   ` Stephen J. Turnbull
2010-09-24  8:16     ` Eli Zaretskii
2010-09-24  8:52       ` Stephen J. Turnbull
2010-09-24 10:03         ` Eli Zaretskii
2010-09-25 14:34           ` Stephen J. Turnbull
2010-09-25 16:10             ` Eli Zaretskii
2010-09-25 18:54               ` Stephen J. Turnbull
2010-09-25 22:07                 ` Eli Zaretskii
2010-09-26 13:08                   ` Stephen J. Turnbull
2010-09-26 19:22                     ` Miles Bader
2010-09-26 19:33                       ` David Kastrup
2010-09-27  4:53                       ` Stephen J. Turnbull
2010-09-27  6:55                         ` David Kastrup
2010-09-27  7:42                           ` Jan Djärv
2010-09-27  8:34                             ` Eli Zaretskii
2010-09-27  9:02                               ` David Kastrup [this message]
2010-09-27 11:02                                 ` Eli Zaretskii
2010-09-27  8:36                           ` Eli Zaretskii
2010-09-27  8:50                           ` Stephen J. Turnbull
2010-09-27  9:39                             ` David Kastrup
2010-09-27  9:45                               ` Lars Magne Ingebrigtsen
2010-09-27 10:11                               ` Stephen J. Turnbull
2010-09-24 10:31 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y6anblv9.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).