Re: Stray pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bruno,

Correct. Performance.

So always do this when declaring a pointer:

Foo* pFoo = NULL; // or else "= new Foo"

And do this when deleting a pointed to object:

delete pFoo;
pFoo = NULL;

...unless you've determined (via profiling) the performance penalty is too high for your application.

Or try to use std::auto_ptr to help with your pointer resource management. Except when the performance penalty is too high for your application.

Or considering using one of the more memory management friendly languages, such as Java. (That's "friendly" in the sense of "safe and easy; one less thing to worry about".)

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux