In article <11**********************@v46g2000cwv.googlegroups .com>,
"Ninan" <ni****@yahoo.com> wrote:
I am skipping a couple of steps in betweens, like inserting into a list
of ints and extracting from it. But this is the gist of what I am
trying to do
class A {
};
A *a = new A();
int b = (int )a;
delete (A *)b;
Is this equivalent to
delete a?
My code seems to work fine
Others have mentioned the importance of the size of the integral type, I
would think it's also important that the type be unsigned, but I could
be wrong. It just seems that conversions could trip you up otherwise.
Personally, long ago I wrote a system like that. I used the pointer
(this) to uniquely identify objects at runtime. Once you start newing
and deleting objects though, all bets are off. Another object my come
along that has the same id.
--
Magic depends on tradition and belief. It does not welcome observation,
nor does it profit by experiment. On the other hand, science is based
on experience; it is open to correction by observation and experiment.