Click here to Skip to main content
15,888,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Constructor / Destructor Question Pin
Eytukan2-Mar-09 20:03
Eytukan2-Mar-09 20:03 
GeneralRe: Constructor / Destructor Question Pin
Richard Andrew x642-Mar-09 7:38
professionalRichard Andrew x642-Mar-09 7:38 
GeneralRe: Constructor / Destructor Question Pin
Eytukan2-Mar-09 19:46
Eytukan2-Mar-09 19:46 
AnswerRe: Constructor / Destructor Question Pin
Perisic, Aleksandar2-Mar-09 5:38
Perisic, Aleksandar2-Mar-09 5:38 
QuestionNeed help on CDateTimeCtrl class Pin
John5022-Mar-09 4:25
John5022-Mar-09 4:25 
AnswerRe: Need help on CDateTimeCtrl class Pin
Perisic, Aleksandar2-Mar-09 6:14
Perisic, Aleksandar2-Mar-09 6:14 
GeneralRe: Need help on CDateTimeCtrl class Pin
John5022-Mar-09 6:57
John5022-Mar-09 6:57 
QuestionPointer Pin
dehseth2-Mar-09 4:25
dehseth2-Mar-09 4:25 
Hey ppl,

I have two pointers and one value:

int* p1 = new int;
*p1 = 10;

int *p2;
p2 = p1;


Now p1 and p2 has different addresses (of course). They both points the same unnamed integer value. Lets delete p1:

delete p1;
p1 = NULL;


Now p1 is NULL and referenced the only integer is deleted. Now if I try

delete p2;
p2 = NULL;


Just crashes cause int which is referenced by p2 is not valid anymore.

So how can I check if int is still valid OR maybe make p2 = NULL when object is deleted.. I read about shared pointers with templated which are not good for me to use right now?

Any workarounds?
QuestionRe: Pointer Pin
prasad_som2-Mar-09 4:54
prasad_som2-Mar-09 4:54 
NewsRe: Pointer Pin
dehseth2-Mar-09 7:29
dehseth2-Mar-09 7:29 
AnswerRe: Pointer Pin
Stephen Hewitt2-Mar-09 5:10
Stephen Hewitt2-Mar-09 5:10 
GeneralRe: Pointer Pin
dehseth2-Mar-09 7:30
dehseth2-Mar-09 7:30 
AnswerRe: Pointer Pin
Stuart Dootson2-Mar-09 7:13
professionalStuart Dootson2-Mar-09 7:13 
GeneralRe: Pointer Pin
dehseth2-Mar-09 7:31
dehseth2-Mar-09 7:31 
GeneralRe: Pointer Pin
Stuart Dootson2-Mar-09 8:07
professionalStuart Dootson2-Mar-09 8:07 
Questionhow to fill out fields in a third party program's GUI window Pin
Tanveer Ansari 12-Mar-09 3:17
Tanveer Ansari 12-Mar-09 3:17 
AnswerRe: how to fill out fields in a third party program's GUI window Pin
Perisic, Aleksandar2-Mar-09 6:02
Perisic, Aleksandar2-Mar-09 6:02 
Questionquestion about structured storages Pin
rkata2-Mar-09 2:38
rkata2-Mar-09 2:38 
AnswerRe: question about structured storages Pin
led mike2-Mar-09 4:10
led mike2-Mar-09 4:10 
QuestionError message Pin
vanishaa2-Mar-09 2:26
vanishaa2-Mar-09 2:26 
AnswerRe: Error message Pin
CPallini2-Mar-09 2:54
mveCPallini2-Mar-09 2:54 
AnswerRe: Error message Pin
David Crow2-Mar-09 3:06
David Crow2-Mar-09 3:06 
GeneralRe: Error message Pin
vanishaa2-Mar-09 3:13
vanishaa2-Mar-09 3:13 
GeneralRe: Error message Pin
David Crow2-Mar-09 3:16
David Crow2-Mar-09 3:16 
GeneralRe: Error message Pin
vanishaa2-Mar-09 3:28
vanishaa2-Mar-09 3:28 

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.