Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: delete pointer. Pin
Cedric Moonen13-Jun-06 22:10
Cedric Moonen13-Jun-06 22:10 
GeneralRe: delete pointer. Pin
see me13-Jun-06 22:21
see me13-Jun-06 22:21 
GeneralRe: delete pointer. Pin
Cedric Moonen13-Jun-06 21:54
Cedric Moonen13-Jun-06 21:54 
AnswerRe: dlete pointer. [modified] Pin
Viorel.13-Jun-06 21:48
Viorel.13-Jun-06 21:48 
GeneralRe: delete pointer. Pin
see me13-Jun-06 22:05
see me13-Jun-06 22:05 
GeneralRe: delete pointer. Pin
toxcct13-Jun-06 22:12
toxcct13-Jun-06 22:12 
GeneralRe: delete pointer. Pin
Cedric Moonen13-Jun-06 22:13
Cedric Moonen13-Jun-06 22:13 
GeneralRe: delete pointer. Pin
Viorel.13-Jun-06 22:16
Viorel.13-Jun-06 22:16 
According to documentation (http://msdn2.microsoft.com/en-us/library/h6227113.aspx[^]), “You can [...] use delete on a pointer with the value 0”.

Therefore instead of

if( p != NULL )
{
    delete p;
    p = NULL;
}

you can use

delete p;
p = NULL;

However, this does not belong to original topic. I think you should put a breakpoint at the line where your block of memory is allocated and the pointer is assigned. Then investigate the pointer’s value and the content of the memory block. Then stop on the line where the pointer is deleted. Check if the pointer contains right address value. Try to use step-be-step execution during deletion. Perhaps the pointer points to an object having destructor, and the problem is within this function.
AnswerRe: dlete pointer. Pin
John R. Shaw13-Jun-06 21:50
John R. Shaw13-Jun-06 21:50 
AnswerRe: dlete pointer. Pin
Hamid_RT13-Jun-06 22:10
Hamid_RT13-Jun-06 22:10 
GeneralRe: delete pointer. Pin
see me13-Jun-06 22:27
see me13-Jun-06 22:27 
GeneralRe: delete pointer. Pin
Hamid_RT13-Jun-06 22:51
Hamid_RT13-Jun-06 22:51 
Questionhow to know the values for event masks Pin
thathvamsi13-Jun-06 21:12
thathvamsi13-Jun-06 21:12 
AnswerRe: how to know the values for event masks Pin
Viorel.13-Jun-06 21:19
Viorel.13-Jun-06 21:19 
GeneralRe: how to know the values for event masks Pin
thathvamsi13-Jun-06 22:37
thathvamsi13-Jun-06 22:37 
AnswerRe: how to know the values for event masks Pin
Hamid_RT13-Jun-06 22:20
Hamid_RT13-Jun-06 22:20 
GeneralRe: how to know the values for event masks Pin
thathvamsi13-Jun-06 22:36
thathvamsi13-Jun-06 22:36 
QuestionOpen vc8 project using vc7.1 [modified] Pin
chybin13-Jun-06 20:55
chybin13-Jun-06 20:55 
QuestionError when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 20:50
RahulOP13-Jun-06 20:50 
AnswerRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen13-Jun-06 20:59
Cedric Moonen13-Jun-06 20:59 
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 21:09
RahulOP13-Jun-06 21:09 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen13-Jun-06 21:24
Cedric Moonen13-Jun-06 21:24 
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 21:41
RahulOP13-Jun-06 21:41 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen13-Jun-06 21:50
Cedric Moonen13-Jun-06 21:50 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Eytukan13-Jun-06 22:11
Eytukan13-Jun-06 22:11 

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.