Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionInterprocess communication in C without pipes or disk Pin
Chris Maunder12-Jul-17 13:14
cofounderChris Maunder12-Jul-17 13:14 
AnswerRe: Interprocess communication in C without pipes or disk Pin
Espen Harlinn12-Jul-17 14:03
professionalEspen Harlinn12-Jul-17 14:03 
GeneralRe: Interprocess communication in C without pipes or disk Pin
leon de boer12-Jul-17 18:49
leon de boer12-Jul-17 18:49 
AnswerRe: Interprocess communication in C without pipes or disk Pin
Randor 13-Jul-17 14:08
professional Randor 13-Jul-17 14:08 
GeneralRe: Interprocess communication in C without pipes or disk Pin
Chris Maunder19-Jul-17 6:01
cofounderChris Maunder19-Jul-17 6:01 
AnswerRe: Interprocess communication in C without pipes or disk Pin
Joe Woodbury17-Jul-17 10:53
professionalJoe Woodbury17-Jul-17 10:53 
Questionwhich one would be better? Pin
bestbear11-Jul-17 1:51
bestbear11-Jul-17 1:51 
AnswerRe: which one would be better? Pin
Jochen Arndt11-Jul-17 3:41
professionalJochen Arndt11-Jul-17 3:41 
Allocating class members on the heap is not per se bad design. It avoids for example stack overflows when the class is created on the stack and the members use a lot of memory.

But allocating and freeing memory frequently reduces the performance significantly. So the Host2 option seems to be the best option for you. If the members use so much memory that stack overflows might occur, create Host2 always on the heap using new.

The indirections should not be a problem. The overhead is very small compared to heap allocation. Some indirections may be also removed by the compiler. And you might not be able to remove them because with your example I did not see a chance to do that:
// Assuming
CHost::GetA() { return &m_A; }
CA::DoSomething { /* body */ }
// then
pHost->GetA()->DoSomething();
// is effectively
pHost->&m_A->DoSomething();
// or 
pHost->m_A.DoSomething();

// Can be also implemented as
CHost::DoSomethingWithA() { m_A.DoSomething(); }
// which is effectively called as
pHost->m_A.DoSomething();
As you can see both methods are not really different.
AnswerRe: which one would be better? Pin
leon de boer11-Jul-17 5:50
leon de boer11-Jul-17 5:50 
AnswerRe: which one would be better? Pin
bestbear11-Jul-17 17:18
bestbear11-Jul-17 17:18 
Questionwhich one would be better? Pin
bestbear11-Jul-17 1:18
bestbear11-Jul-17 1:18 
Questionquestions plz solve throught c or c++ Pin
Member 1330375110-Jul-17 22:51
Member 1330375110-Jul-17 22:51 
AnswerRe: questions plz solve throught c or c++ Pin
CodeWraith10-Jul-17 23:21
CodeWraith10-Jul-17 23:21 
AnswerRe: questions plz solve throught c or c++ Pin
Richard MacCutchan11-Jul-17 0:21
mveRichard MacCutchan11-Jul-17 0:21 
AnswerRe: questions plz solve throught c or c++ Pin
Patrice T16-Jul-17 17:34
mvePatrice T16-Jul-17 17:34 
QuestionHow to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
lolici10-Jul-17 8:07
lolici10-Jul-17 8:07 
AnswerRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
Richard MacCutchan10-Jul-17 21:28
mveRichard MacCutchan10-Jul-17 21:28 
AnswerRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
Jochen Arndt10-Jul-17 21:38
professionalJochen Arndt10-Jul-17 21:38 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
lolici11-Jul-17 8:33
lolici11-Jul-17 8:33 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
Jochen Arndt11-Jul-17 9:08
professionalJochen Arndt11-Jul-17 9:08 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
lolici11-Jul-17 9:18
lolici11-Jul-17 9:18 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
lolici15-Jul-17 3:53
lolici15-Jul-17 3:53 
GeneralRe: How to save the filename retrieved from a dialog class using CMFCEditBrowseCtrl? Pin
Jochen Arndt15-Jul-17 22:00
professionalJochen Arndt15-Jul-17 22:00 
QuestionProblem in precedence of operators. Pin
parkavikkk7-Jul-17 21:25
parkavikkk7-Jul-17 21:25 
AnswerRe: Problem in precedence of operators. Pin
Richard MacCutchan7-Jul-17 22:02
mveRichard MacCutchan7-Jul-17 22:02 

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.