[Gc] Basic questions

Fergus Henderson fjh@cs.mu.oz.au
Sat, 10 May 2003 15:12:14 +1000

On 09-May-2003, Emmanuel Stapf [ES] <manus@eiffel.com> wrote:
> > I don't think so.  If you register offsets "2" and "4" using 
> > GC_register_displacement(), and "p" is a pointer returned 
> > from GC_malloc(), then "p", "(char *)p + 2", and "(char *)p + 
> > 4" would all be considered valid pointers, but "(char *)p + 
> > 1" and "(char *)p + 3" would not.  If you want to register 
> > all offsets up to and including "n", then have to do so 
> > explicitly, e.g. using a loop:
> Thanks. In my case I just wanted to have (char *) p + 8. I tried that by using
> `GC_register_displacement (8)', but it didn't work at all.

That is supposed to work.

> Actually it brings up a question, if I do `GC_register_displacement(0)' and
> `GC_register_displacement(8)' only, will it be more efficient than compiling

Yes, it should be.

You don't need to do GC_register_displacement(0).
(Maybe that is why it was crashing?)

Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.