Click here to Skip to main content
15,921,276 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Removing Duplicates from CListCtrl Pin
David Crow22-May-03 2:37
David Crow22-May-03 2:37 
GeneralRe: STRANGE PROBLEM Pin
Neville Franks21-May-03 23:57
Neville Franks21-May-03 23:57 
GeneralPrevent webbrowser win activation Pin
rrrado21-May-03 22:36
rrrado21-May-03 22:36 
GeneralCString Class & Find Function... Pin
JongGu Kim21-May-03 22:23
JongGu Kim21-May-03 22:23 
GeneralRe: CString Class & Find Function... Pin
rrrado21-May-03 22:39
rrrado21-May-03 22:39 
QuestionIs deleting "void*" safe? Pin
Abin21-May-03 22:08
Abin21-May-03 22:08 
AnswerRe: Is deleting "void*" safe? Pin
rrrado21-May-03 22:41
rrrado21-May-03 22:41 
AnswerRe: Is deleting "void*" safe? Pin
Iain Clarke, Warrior Programmer21-May-03 23:19
Iain Clarke, Warrior Programmer21-May-03 23:19 
Contrary to an earlier reply, I would say NO.

If you think about delete, it is actually a two stage process.
1) Call the destructor.
2) Give the memory back.

deleteing a void pointer may do a free on the memory, thus completing stage 2,
but the compiler wouldn't have a clue as to which destructor (if any) to call. At
best you would not completely dismantle the class (imagine if it had pointers to other
allocated memory...)

If you really wanted a generic delete, then have a very basic class
that all of your generics inherit from:

class GenericBase
{
public:
    virtual ~GenericBase () {}
};

class Specific : public GenericBase
{

};


And use a GenericBase * in place of the void * in your code. The virtual
destructor means any inheriting class have a vtable and thus will have their (or ancestor
classes) destructor called as well.

I feel all "Matt Pietrik"y!

Iain.
GeneralRe: Is deleting "void*" safe? Pin
Abin21-May-03 23:58
Abin21-May-03 23:58 
GeneralRe: Is deleting "void*" safe? Pin
rrrado22-May-03 1:06
rrrado22-May-03 1:06 
Generalinheritance of templates & linking Pin
Themis21-May-03 21:51
Themis21-May-03 21:51 
GeneralRe: inheritance of templates & linking Pin
Iain Clarke, Warrior Programmer21-May-03 23:27
Iain Clarke, Warrior Programmer21-May-03 23:27 
GeneralRe: inheritance of templates & linking Pin
Themis22-May-03 1:07
Themis22-May-03 1:07 
GeneralRe: inheritance of templates & linking Pin
Iain Clarke, Warrior Programmer22-May-03 1:30
Iain Clarke, Warrior Programmer22-May-03 1:30 
Generalfile list Pin
YanivNahum21-May-03 21:50
YanivNahum21-May-03 21:50 
GeneralRe: file list Pin
Martyn Pearson21-May-03 22:57
Martyn Pearson21-May-03 22:57 
GenerallDrawing a staic picture onto a moving(constant refreshing) picture Pin
Member 40481321-May-03 21:50
Member 40481321-May-03 21:50 
GeneralWindows GINA Pin
Lim Bio Liong21-May-03 21:43
Lim Bio Liong21-May-03 21:43 
GeneralDifficult - Owner data in CListCtrl - Pin
JensB21-May-03 20:22
JensB21-May-03 20:22 
GeneralRe: Difficult - Owner data in CListCtrl - Pin
Rage21-May-03 21:12
professionalRage21-May-03 21:12 
GeneralRe: Difficult - Owner data in CListCtrl - Pin
JensB21-May-03 21:28
JensB21-May-03 21:28 
GeneralRe: Difficult - Owner data in CListCtrl - Pin
JensB21-May-03 22:05
JensB21-May-03 22:05 
GeneralRe: Difficult - Owner data in CListCtrl - Pin
Rage21-May-03 22:15
professionalRage21-May-03 22:15 
GeneralRe: Difficult - Owner data in CListCtrl - Pin
Rage21-May-03 22:06
professionalRage21-May-03 22:06 
GeneralRe: Difficult - Owner data in CListCtrl - Pin
JensB21-May-03 22:16
JensB21-May-03 22:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.