Click here to Skip to main content
15,915,093 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to know whether a file is saved or not Pin
Jijo.Raj17-Aug-06 14:55
Jijo.Raj17-Aug-06 14:55 
GeneralRe: How to know whether a file is saved or not Pin
Hamid_RT18-Aug-06 6:43
Hamid_RT18-Aug-06 6:43 
QuestionLPTSTR to char* Pin
georgekjolly17-Aug-06 6:51
georgekjolly17-Aug-06 6:51 
AnswerRe: LPTSTR to char* Pin
led mike17-Aug-06 6:55
led mike17-Aug-06 6:55 
QuestionRe: LPTSTR to char* Pin
David Crow17-Aug-06 6:55
David Crow17-Aug-06 6:55 
AnswerRe: LPTSTR to char* Pin
Zac Howland17-Aug-06 6:57
Zac Howland17-Aug-06 6:57 
Questionc++ Pin
jon-8017-Aug-06 6:05
professionaljon-8017-Aug-06 6:05 
AnswerRe: c++ Pin
Zac Howland17-Aug-06 6:13
Zac Howland17-Aug-06 6:13 
jon_80 wrote:
while(pTemp != NULL)
{
CGenericNode<t> *pRemember = pTemp->m_pNextNode;
free (pTemp->m_data);
pTemp = pRemember;
}


First, it doesn't look like you are allocating your data variable on the heap, so there is no need to delete it.

Second, it is generally unwise to use 2 different heaps like this (malloc/free is not the same heap as that of new/delete).

Third, in general, when writing generic classes like this, you accept any type and just hold it. If your link list is holding pointers (e.g. char*), it is up to the module that created those pointers to delete them. This is especially true in this case since if you pass a pointer to a char* that was created with new and try to free it using free instead of delete, you will corrupt memory.

If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac

GeneralRe: c++ Pin
jon-8017-Aug-06 8:02
professionaljon-8017-Aug-06 8:02 
GeneralRe: c++ Pin
Zac Howland17-Aug-06 8:16
Zac Howland17-Aug-06 8:16 
GeneralRe: c++ Pin
jon-8018-Aug-06 9:01
professionaljon-8018-Aug-06 9:01 
QuestionLinking Error /outportb Pin
cahit2317-Aug-06 5:55
cahit2317-Aug-06 5:55 
AnswerRe: Linking Error /outportb Pin
kakan17-Aug-06 20:48
professionalkakan17-Aug-06 20:48 
Questionproblems with winsock Pin
afpr17-Aug-06 5:43
afpr17-Aug-06 5:43 
AnswerRe: problems with winsock Pin
lucy17-Aug-06 5:47
lucy17-Aug-06 5:47 
GeneralRe: problems with winsock [modified] Pin
afpr17-Aug-06 6:04
afpr17-Aug-06 6:04 
GeneralRe: problems with winsock Pin
Zac Howland17-Aug-06 6:23
Zac Howland17-Aug-06 6:23 
GeneralRe: problems with winsock [modified] Pin
afpr17-Aug-06 6:26
afpr17-Aug-06 6:26 
GeneralRe: problems with winsock Pin
Zac Howland17-Aug-06 6:58
Zac Howland17-Aug-06 6:58 
GeneralRe: problems with winsock Pin
afpr17-Aug-06 8:16
afpr17-Aug-06 8:16 
GeneralRe: problems with winsock Pin
David Crow17-Aug-06 8:24
David Crow17-Aug-06 8:24 
GeneralRe: problems with winsock Pin
Zac Howland17-Aug-06 9:50
Zac Howland17-Aug-06 9:50 
GeneralRe: problems with winsock Pin
afpr17-Aug-06 10:33
afpr17-Aug-06 10:33 
GeneralRe: problems with winsock Pin
Zac Howland17-Aug-06 10:42
Zac Howland17-Aug-06 10:42 
GeneralRe: problems with winsock Pin
afpr17-Aug-06 11:40
afpr17-Aug-06 11:40 

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.