>>>> "JV" == Jan Vroonhof
<vroonhof(a)math.ethz.ch> writes:
JV> Martin Buchholz <martin(a)xemacs.org> writes:
JV> [My first post seems missing from the list. Sorry if you see this twice]
> I'd like you to prove me wrong - in this case I would support
the
> permanent switch to C++.
JV> Here is something I prepared earlier (ahem). All these structs would
JV> be typedef'ed in a real use of course. I think you can do this
JV> checking as long as you allow about 6 or so different types that under
JV> C would all just be the same thing.
JV> g++ -c gcpro.C
JV> gcpro.C: In function `void incorrect()':
JV> gcpro.C:74: conversion from `rv_lispobj' to non-scalar type
`funarg_lispobj' requested
This is very interesting. I now agree that something like this would
work, and would be useful at least for debugging GCPROs, and might be
the way to go for XEmacs production code.
One idea for automatic GCPROing: Any Lisp_Object has to live in data,
bss, stack, or heap. Presumably this can be detected using configure
tests and such. If a Lisp_Object, even a temporary one, is being
constructed with an address on the stack, it can simply GCPRO itself.
This is a little tricky, since the order of objects allocated and
deallocated will not be completely stacklike. When a function
returns, the return value will be constructed via a copy constructor,
the original value will be destructed afterwards. I think...