[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: Stefan Monnier
Subject: Re: Lisp object that refers to a C struct
Date: Thu, 18 Oct 2012 08:33:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

>> In that case, wouldn't it be better to have the integer be an index
>> into a table, like Stefan suggested?
> It's easy to do that (of course, at a price of some slightly more
> complicated memory management),

I don't understand why the memory management would care about which
integer you use to represent file-watcher descriptors.

> but I think Stefan still prefers the "new object" solution.

I generally like stronger types, so you're probably right, but an "index
into a table" doesn't necessarily sound so terribly bad, if you have
such a table anyway (BTW, is this table usable by Lisp, e.g. can they
get the list of current file-watchers?).

>> It's faster to check that it is in range than compare it with an
>> arbitrarily long list of known pointers.
> That's not what the code does.  It calls Fassoc_quit to find the
> descriptor in the list of known live watches (which will still be
> needed under the table suggestion),

Isn't Fassoc_quit going to "compare it with an arbitrarily long list"?
To me this "list of known live watches" sounds exactly like the "table"
I mention above.

> and then validates the pointer itself, just in case (which is also
> independent of the table suggestion).

What means "validate"?


reply via email to

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