Click here to Skip to main content
15,895,423 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Apartment model, COM and misery (duplicate from the COM forum) Pin
JWood8-Sep-06 6:53
JWood8-Sep-06 6:53 
GeneralRe: Apartment model, COM and misery (duplicate from the COM forum) Pin
BadJerry8-Sep-06 7:02
BadJerry8-Sep-06 7:02 
GeneralRe: Apartment model, COM and misery (duplicate from the COM forum) Pin
JWood8-Sep-06 7:39
JWood8-Sep-06 7:39 
GeneralRe: Apartment model, COM and misery (duplicate from the COM forum) Pin
BadJerry8-Sep-06 8:23
BadJerry8-Sep-06 8:23 
GeneralRe: Apartment model, COM and misery (duplicate from the COM forum) [modified] Pin
JWood8-Sep-06 8:44
JWood8-Sep-06 8:44 
GeneralRe: Apartment model, COM and misery (duplicate from the COM forum) Pin
BadJerry8-Sep-06 9:51
BadJerry8-Sep-06 9:51 
Questionassert... Pin
jon-808-Sep-06 5:19
professionaljon-808-Sep-06 5:19 
AnswerRe: assert... Pin
Zac Howland8-Sep-06 5:26
Zac Howland8-Sep-06 5:26 
There will be a memory leak. x1 and x2 both declare a boolean variable on the heap. Since Object doesn't have a copy-constructor/assignment operator, it uses the implicit one that will copy the value of the pointer from x2 to x1. Thus, the data that x1's original pointer was pointing to is still allocated, but has no way of getting access to it to delete it.

Worse, if the line *pAlive = false; is not there, the code will actually cause memory corruption since x1 and x2 will both have pointers to the same boolean variable and will both try to delete it.

NOTE: In general, I wouldn't answer homework questions this thoroughly ... but I'm feeling generous today.

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

AnswerRe: assert... Pin
Anand Vivek Srivastava8-Sep-06 5:42
Anand Vivek Srivastava8-Sep-06 5:42 
AnswerRe: assert... Pin
John M. Drescher8-Sep-06 5:48
John M. Drescher8-Sep-06 5:48 
GeneralRe: assert... Pin
Zac Howland8-Sep-06 6:40
Zac Howland8-Sep-06 6:40 
QuestionCImage Pin
messages8-Sep-06 3:56
messages8-Sep-06 3:56 
AnswerRe: CImage Pin
Christopher Stratmann8-Sep-06 4:17
Christopher Stratmann8-Sep-06 4:17 
GeneralRe: CImage Pin
messages8-Sep-06 4:27
messages8-Sep-06 4:27 
GeneralRe: CImage Pin
Christopher Stratmann8-Sep-06 5:54
Christopher Stratmann8-Sep-06 5:54 
QuestionNamed Pipes buffer problem (Win32) Pin
vga28-Sep-06 2:53
vga28-Sep-06 2:53 
AnswerRe: Named Pipes buffer problem (Win32) Pin
Richard Andrew x648-Sep-06 19:48
professionalRichard Andrew x648-Sep-06 19:48 
GeneralRe: Named Pipes buffer problem (Win32) Pin
vga210-Sep-06 22:36
vga210-Sep-06 22:36 
QuestionRPC Authentication won't work Pin
Mr.Brainley8-Sep-06 2:13
Mr.Brainley8-Sep-06 2:13 
AnswerRe: RPC Authentication won't work Pin
Programm3r8-Sep-06 2:20
Programm3r8-Sep-06 2:20 
GeneralRe: RPC Authentication won't work Pin
Mr.Brainley8-Sep-06 2:39
Mr.Brainley8-Sep-06 2:39 
GeneralRe: RPC Authentication won't work Pin
Programm3r8-Sep-06 2:43
Programm3r8-Sep-06 2:43 
Questionerror C2248: cannot access protected member declared in class 'CEmployee' Pin
jon-808-Sep-06 1:51
professionaljon-808-Sep-06 1:51 
AnswerRe: error C2248: cannot access protected member declared in class 'CEmployee' Pin
prasad_som8-Sep-06 2:04
prasad_som8-Sep-06 2:04 
AnswerRe: error C2248: cannot access protected member declared in class 'CEmployee' Pin
David Crow8-Sep-06 3:18
David Crow8-Sep-06 3:18 

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.