[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] Reliable detection of pointers (C++)
From: |
Joris van der Hoeven |
Subject: |
Re: [Texmacs-dev] Reliable detection of pointers (C++) |
Date: |
Tue, 25 May 2004 16:16:14 +0200 (CEST) |
> Implementing a marking algorithm
> --------------------------------
...
> Of course, it would be really great if C++ could come with
> native support for marking algorithms. Something like
> an operator mark for each type whose default implementation
> (for new classes) would be to call a global (redefinable) marking
> operator with the address of the object. This routine returns
> true if the object was not already marked and false otherwise.
> Next the marking operator is recursively called for all fields.
> The default implementation for base classes (int, char, etc.)
> would be no-op and the default implementation for pointer
> classes T* would be to call the marking operator for
> the pointed object.
...
I now wonder if we cannot write an automated tool ourselves for
doing this (volunteers may even use OCaml!). The idea would be to
parse each C++ source file for type declarations and automatically
generate the corresponding marking routine. We next collect all
these routines and put them in a big file which could (or could not)
be distributed with the sources. I think such a thing would be
a nice contribution for a hacker, since it would allow us to
implement any garbage collection system of our liking,
even compactifying systems.