From: gavino on
anyone using this?
From: ok on
On 23 Giu, 11:35, vino wrote:
> anyone using this?

C++ is using this heavily.
And if you try to remove it, it will cry:

delete this; // ouch!!
From: Frank Buss on
ok wrote:

> C++ is using this heavily.
> And if you try to remove it, it will cry:
>
> delete this; // ouch!!

This is no problem, if you don't try it for objects allocated on the stack
and if you don't access any member variables after the delete.

BTW: what do you think about C++0x? Lots of useful things, e.g. many
features from Boost, like shared_ptr, are now part of the core libraries
and some new language syntax for lambda functions and other things might be
useful, but it makes the language even more complicated, and it still
didn't reached Common Lisp, e.g. garbage collection was postponed.

--
Frank Buss, fb(a)frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: ok on
On 24 Giu, 11:43, Frank Buss <f...(a)frank-buss.de> wrote:
> ok wrote:
> > delete this; // ouch!!
>
> This is no problem, if you don't try it for objects allocated on the stack
> and if you don't access any member variables after the delete.

Good to know it does not "ouch" in some special cases, which you will
easily recall if you are a C++ forger, sorry, coder.

(Basically you just need to add it to the other 2.310.571.812 special
cases any C++ hacker worth his money already has forged hard enough
into his "static const RAM const".)

But someone forgot to add it to "C++ best practices".
 | 
Pages: 1
Prev: strange behaviour
Next: Learning Lisp