[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lisp object that refers to a C struct
From: |
Eli Zaretskii |
Subject: |
Re: Lisp object that refers to a C struct |
Date: |
Thu, 18 Oct 2012 06:50:49 +0200 |
> Date: Wed, 17 Oct 2012 15:08:52 -0700
> From: Paul Eggert <address@hidden>
> CC: address@hidden
>
> On 10/17/2012 01:46 PM, Eli Zaretskii wrote:
> >> How do you convert the integer into the C struct pointer?
> > struct foo *pwatch = (struct foo *)XLI (watch_descriptor);
> >
> > where watch_descriptor is a Lisp integer.
>
> Won't this have problems on platforms where
> (EMACS_INT) pwatch < MOST_NEGATIVE_FIXNUM,
> or where MOST_POSITIVE_FIXNUM < (EMACS_INT) pwatch?
Given what XLI does, I don't see how this could happen, with
watch_descriptor being a Lisp integer.
> Also, suppose someone makes up a random integer
> and then passes it as the watch descriptor --
> wouldn't Emacs dump core?
No, because, like Stephen says, the descriptor is first validated
against a list of known ones.
- Re: Lisp object that refers to a C struct, (continued)
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/17
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/17
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/17
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/17
- Re: Lisp object that refers to a C struct, Paul Eggert, 2012/10/17
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/17
- Re: Lisp object that refers to a C struct, Stephen J. Turnbull, 2012/10/17
- Re: Lisp object that refers to a C struct,
Eli Zaretskii <=
- Re: Lisp object that refers to a C struct, Paul Eggert, 2012/10/18
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/18
- Re: Lisp object that refers to a C struct, Paul Eggert, 2012/10/18
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/18
- Re: Lisp object that refers to a C struct, Juanma Barranquero, 2012/10/18
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/18
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/18
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/18
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/18
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/19