"Richard Harter" <cri@tiac.netwr ote in message
news:4910af56.1 46445250@news.s btc.net...
As I understand this problem: you may have a number of assorted references
to an object.
These objects may be deleted, and you want to verify that an existing
reference still points to an undeleted object.
Your idea of using a unique-id sounds reasonable, but, why not just use the
reference as the unique id?
Then you just need a set containing all the valid references; if a reference
is in the set, then it's valid. Deleting an object removes it's reference
from the set; creating one will add it to the set. (And in C, a set can be
just a hash-array.)
The reference can also become an ordinary C pointer.
--
Bartc
news:4910af56.1 46445250@news.s btc.net...
>
>
Suppose we are writing a program in C and that we have a
particular kind of object (in the sense of OO programming) that I
>
will call bobbles. Being well disciplined programmers (Ha!) we
create a module to package our bobble related functions together.
>
Suppose we are writing a program in C and that we have a
particular kind of object (in the sense of OO programming) that I
>
will call bobbles. Being well disciplined programmers (Ha!) we
create a module to package our bobble related functions together.
I am going to throw in one curve ball. Our program will contain
references to created bobbles; we won't know where these are so
they can go stale when we delete bobbles. The code will need to
be able to detect that a reference has gone stale and deal with
it appropriately.
references to created bobbles; we won't know where these are so
they can go stale when we delete bobbles. The code will need to
be able to detect that a reference has gone stale and deal with
it appropriately.
to an object.
These objects may be deleted, and you want to verify that an existing
reference still points to an undeleted object.
Your idea of using a unique-id sounds reasonable, but, why not just use the
reference as the unique id?
Then you just need a set containing all the valid references; if a reference
is in the set, then it's valid. Deleting an object removes it's reference
from the set; creating one will add it to the set. (And in C, a set can be
just a hash-array.)
The reference can also become an ordinary C pointer.
--
Bartc
Comment