Boost logo

Boost :

Subject: Re: [boost] [Root Pointer] New Documentation
From: Peter Dimov (lists_at_[hidden])
Date: 2016-04-13 10:10:21


Phil,

You still haven't answered my earlier questions, which were

- in what scenarios would one use root_ptr and in what node_ptr,
- what happens when one doesn't observe the above guidelines

Perhaps you didn't understand the questions, so I'll go into more detail.

"Root" is GC terminology. It refers to the pointers from which tracing
starts (those on the stack, in static variables, in registers.)

So by your calling root_ptr root_ptr, I can deduce that you intend root_ptr
to be used for root pointers, and node_ptr to be used for non-root pointers.

Meaning, if we go by classic GC terminology, that automatic and static
variables should be root_ptr, and the rest should be node_ptr. Right?

If that's correct, my question is then what happens when you use node_ptr
for roots, and root_ptr for non-roots. That is, what happens when you use
node_ptr as an automatic or a static variable (currently a dangling pointer,
as we learned in a previous post) and what happens when you use root_ptr for
a non-root pointer.

Specifically, in

    R1 -> N1 <-> N2

N1 and N2 are destroyed when R1 is destroyed. But what happens in

    R1 -> R2 <-> R3

or in

    R1 -> R2 <-> N3

or in

    R1 -> N2 <-> R3

when R1 is destroyed?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk