Click here to Skip to main content
15,899,009 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Color one coloumn text of ListCotrol ! Pin
decoder_8524-Nov-10 17:10
decoder_8524-Nov-10 17:10 
QuestionHelp for EditBox control ! Pin
Le@rner26-Aug-08 23:44
Le@rner26-Aug-08 23:44 
AnswerRe: Help for EditBox control ! Pin
Naveen26-Aug-08 23:53
Naveen26-Aug-08 23:53 
GeneralRe: Help for EditBox control ! Pin
Le@rner26-Aug-08 23:58
Le@rner26-Aug-08 23:58 
Questionusing reference as member variable is dangerous? Pin
George_George26-Aug-08 23:42
George_George26-Aug-08 23:42 
AnswerRe: using reference as member variable is dangerous? Pin
Roger Stoltz27-Aug-08 0:03
Roger Stoltz27-Aug-08 0:03 
GeneralRe: using reference as member variable is dangerous? Pin
George_George27-Aug-08 1:47
George_George27-Aug-08 1:47 
AnswerRe: using reference as member variable is dangerous? Pin
Roger Stoltz27-Aug-08 2:16
Roger Stoltz27-Aug-08 2:16 
George_George wrote:
do an instance copy when constructing the data member, not using a reference. Do you think it is a good idea?


Well, it depends.
Consider what happens if the original value is updated....the copy will become obsolete.
A common problem is to have two instances of the same data; if they get out of sync you don't know which is the correct one. But this may not be a concern, it depends on what you're trying to do.

I would stick to the smart pointer solution.
That way I don't have to worry about the object being destroyed in the background and is safe to use until every object has released their references to it. Sometimes it's hard to know which object is the last to be destroyed and then clean up the memory, but by using a reference counting smart pointer the problem will be solved automagically.
With a smart pointer I would also have the data in one place and in case the data is updated, every "user" of it can read the new value from the same place.


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown


GeneralRe: using reference as member variable is dangerous? Pin
George_George27-Aug-08 2:18
George_George27-Aug-08 2:18 
AnswerRe: using reference as member variable is dangerous? Pin
SandipG 27-Aug-08 0:26
SandipG 27-Aug-08 0:26 
GeneralRe: using reference as member variable is dangerous? Pin
Roger Stoltz27-Aug-08 1:32
Roger Stoltz27-Aug-08 1:32 
GeneralRe: using reference as member variable is dangerous? Pin
George_George27-Aug-08 1:49
George_George27-Aug-08 1:49 
GeneralRe: using reference as member variable is dangerous? Pin
George_George27-Aug-08 1:48
George_George27-Aug-08 1:48 
GeneralRe: using reference as member variable is dangerous? Pin
SandipG 27-Aug-08 2:02
SandipG 27-Aug-08 2:02 
GeneralRe: using reference as member variable is dangerous? Pin
George_George27-Aug-08 2:17
George_George27-Aug-08 2:17 
Questiondisplaying output to edit boxes like printf Pin
l_d26-Aug-08 23:23
l_d26-Aug-08 23:23 
AnswerRe: displaying output to edit boxes like printf Pin
toxcct26-Aug-08 23:27
toxcct26-Aug-08 23:27 
AnswerRe: displaying output to edit boxes like printf Pin
_AnsHUMAN_ 26-Aug-08 23:28
_AnsHUMAN_ 26-Aug-08 23:28 
AnswerRe: displaying output to edit boxes like printf Pin
Perspx26-Aug-08 23:31
Perspx26-Aug-08 23:31 
AnswerRe: displaying output to edit boxes like printf Pin
CPallini26-Aug-08 23:33
mveCPallini26-Aug-08 23:33 
GeneralRe: displaying output to edit boxes like printf Pin
l_d27-Aug-08 0:07
l_d27-Aug-08 0:07 
GeneralRe: displaying output to edit boxes like printf Pin
_AnsHUMAN_ 27-Aug-08 0:26
_AnsHUMAN_ 27-Aug-08 0:26 
GeneralRe: displaying output to edit boxes like printf Pin
l_d27-Aug-08 5:51
l_d27-Aug-08 5:51 
QuestionNeed some samples to remove the items from context menu Pin
Bernaad26-Aug-08 23:12
Bernaad26-Aug-08 23:12 
QuestionC Library Pin
j_j_j26-Aug-08 22:58
j_j_j26-Aug-08 22:58 

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.