On 25 Sep 1999 10:59:52 +0200, Lars Gullik Bj°nnes wrote: >"Arnd Hanses" <[EMAIL PROTECTED]> writes: > >| { >| [VIP] >| FOO foo; >| FOO * p = foo; >| VIPfunc(p) >| [VIP] >| } > >We should never to a thing like that. What we could/should do is: > >VIPFunc(FOO & r) { > // use r >} > >{ > [VIP] > FOO foo; > VIPFunc(foo); > [VIP] >} Yes, this is what *must* be done in C++. >Making a pointer out of local variables or references are error prone. Using pointers (whether pointing to locals or globals) is always error prone. Think of deleting/overwriting the referenced object somewhere in the huge code base or think of subtly buggy pointer arithmetics; you won't notice. Same thing with malloc()/new: Try to redesign your work wherever possible to avoid such error prone instruments. Greets, Arnd
- Re: 'new'/'delete' and malloc()/free() -... Amir Karger
- Re: 'new'/'delete' and malloc()/free... Lars Gullik Bjønnes
- Re: 'new'/'delete' and malloc()/free() - lclint f... Arnd Hanses
- Re: 'new'/'delete' and malloc()/free() - lclint f... Lars Gullik Bjønnes
- Re: 'new'/'delete' and malloc()/free() - lclint f... Arnd Hanses
- Re: 'new'/'delete' and malloc()/free() - lclint f... Lars Gullik Bjønnes
- Re: 'new'/'delete' and malloc()/free() - lclint f... Arnd Hanses
- Re: 'new'/'delete' and malloc()/free() - lclint f... Lars Gullik Bjønnes
- Re: 'new'/'delete' and malloc()/free() - lclint f... Arnd Hanses
- Re: 'new'/'delete' and malloc()/free() - lclint f... Lars Gullik Bjønnes
- Re: 'new'/'delete' and malloc()/free() - lclint f... Arnd Hanses
- Re: 'new'/'delete' and malloc()/free() - lclint f... Asger K. Alstrup Nielsen