Click here to Skip to main content
15,898,374 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Color one coloumn text of ListCotrol ! Pin
decoder_8523-Nov-10 23:18
decoder_8523-Nov-10 23:18 
GeneralRe: Color one coloumn text of ListCotrol ! Pin
Le@rner24-Nov-10 0:03
Le@rner24-Nov-10 0:03 
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 
George_George wrote:
1. if the _buf is binded to a local variable (e.g. a local string variable), then if instance of Foo lives longer than the local variable, is it safe?


No, you'll get an access violation when trying to use the destroyed object.


George_George wrote:
2. if the _buf is binded to a heap variable, and it is released some time but Foo does not the release operation, then using _buf is not safe?


Confused | :confused: "release"??!?
Don't you mean "deleted"?
If by "released" you mean that the object is destroyed, you'll have exactly the same problem as in #1; you'll get an access violation when you're trying to use the destroyed object. It doesn't matter whether the object is on the heap or the stack.


I suggest you use a reference counting smart pointer instead.
Just do a search here at CP, there are quite a few good examples.


"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 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 
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 

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.