Had to stick them here, as the capability of the C++ forum to generate piles of crap is unbelievable, and gems like these get lost in the process. Both messages are from Bench who, AFAICT, is probably the most matter-of-fact, no BS expert around here. As said before, I am learning C++ on the side, and his 2 messages taught me more than anything I have learnt from wandering around here for 2 months...
The first one was about a neat little trick to tell whether a class and its subclass are related, and the second one is about pointers, and how one should favour auto_ptr to handle them.
Researching this a bit more, I came across this interesting dialogue about auto_ptr vs. (Boost) shared_ptr soon-to-become-c++-standard-but-wait-a-bit-like-we-are-still-waiting-for-LaTeX3. Some bits are just plain obscure for me, but still, I get the point. This led me to investigate shared_ptr:
And that's it, that's the talent of the man: 2 well-written posts jam-packed with technical details, enough thread sticking out of the ball, and you end up dragging enough wool out to start knitting a decent pair of socks. Good job, Bench.
The first one was about a neat little trick to tell whether a class and its subclass are related, and the second one is about pointers, and how one should favour auto_ptr to handle them.
Researching this a bit more, I came across this interesting dialogue about auto_ptr vs. (Boost) shared_ptr soon-to-become-c++-standard-but-wait-a-bit-like-we-are-still-waiting-for-LaTeX3. Some bits are just plain obscure for me, but still, I get the point. This led me to investigate shared_ptr:
Quote
A simple guideline that nearly eliminates the possibility of memory leaks is: always use a named smart pointer variable to hold the result of new. Every occurrence of the new keyword in the code should have the form:
shared_ptr<T> p(new Y);
And that's it, that's the talent of the man: 2 well-written posts jam-packed with technical details, enough thread sticking out of the ball, and you end up dragging enough wool out to start knitting a decent pair of socks. Good job, Bench.
0 Comments On This Entry
About...
This is my fake blog. 'Cause I also have a real blog with real stuff in it.
← January 2022 →
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
Tags
My Blog Links
Recent Entries
-
Rock, Paper, Scissorson Feb 12 2010 06:40 AM
-
My Latest GreaseMonkey Script for DICon Feb 11 2010 04:29 AM
-
2 Messages of Noteon Nov 24 2009 04:46 PM
-
Palindrome with a Stack in C++on Nov 06 2009 03:13 PM
-
Pathfinding: Walk on the Bridge (II)on Nov 06 2009 10:46 AM
Recent Comments
Search My Blog
7 user(s) viewing
7 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)



Leave Comment








|