FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
July 01, 2005

Unsmart Pointers, Part I

(Page 4 of 7)

July, 2005: Unsmart Pointers, Part I

Listing 3

SomeObject* SomeFunction1();

void CodeSnippet1() {
  // something fishy going on, but nothing identifiable by compiler
  SomeObject* p;
  p = SomeFunction1();
  delete p;
}

undeletable_ptr<SomeObject> SomeFunction2();

void CodeSnippet2() {
  SomeObject* p;
  p = SomeFunction2(); // compilation error
  delete p;
}

undeletable_ptr<SomeObject> SomeFunction3();

void CodeSnippet3() {
  undeletable_ptr<SomeObject> p;
  p = SomeFunction3();
  delete p; // compilation error
}

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK