Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Smart pointers impractical a lot of the time

Reply
Thread Tools

Smart pointers impractical a lot of the time

 
 
Evan
Guest
Posts: n/a
 
      06-23-2003
Chandra Shekhar Kumar <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> donot use dude pointers ...use smart pointer instead


There's a problem with this approach. You have three options for using
smart pointers:

1) Use the standard library's auto_ptr,
2) Use one from another library, or
3) Write your own.

Option 3 is out because it requires intimate knowledge of the
different ways smart pointers can work and the uses it will be
subjected to. The poster is asking what the point of pointers is
(haha... *sees pun*) so I think it's safe to assume that neither of
these points are met.

Option 2 is better, but the lack of any standard implementation of
smart pointers (besides auto_ptr) means that generic books can't teach
it, libraries can't make good use of it, etc. Probably because of this
(and in spite of auto_ptr) I didn't know what smart pointers were
until a few days ago despite C++ programming for a couple years.

Option 1 is the most promising until you realize that the auto_ptr
doesn't behave appropriately in most circumstances. If the stardard
library had a painter with reference counting, then things wauld be in
much better shape.
 
Reply With Quote
 
 
 
 
Howard Hinnant
Guest
Posts: n/a
 
      06-23-2003
In article <(E-Mail Removed) >, Evan
<(E-Mail Removed)> wrote:

| 1) Use the standard library's auto_ptr,

| Option 1 is the most promising until you realize that the auto_ptr
| doesn't behave appropriately in most circumstances. If the stardard
| library had a painter with reference counting, then things wauld be in
| much better shape.

We're getting there...

http://anubis.dkuug.dk/jtc1/sc22/wg2...003/n1450.html

This was voted into a "Library Technical Report" just this Spring.
Vendors may ship it in namespace std::tr1 in the near future.

--
Howard Hinnant
Metrowerks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pointers, pointers, pointers... cerr C Programming 12 04-07-2011 11:17 PM
Smart Pointers: Is there something similar to smart pointers in C? MotoK C Programming 59 09-15-2006 07:03 PM
Smart pointers and member function pointers n2xssvv g02gfr12930 C++ 3 11-27-2005 10:51 AM
Null pointers in C---spec (N869) trouble, was What computer language is used a lot in the IT industry? Thomas G. Marshall C Programming 2 07-02-2004 11:46 PM



Advertisments