Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Function out of scope Pin
hrishiS8-Sep-09 2:09
hrishiS8-Sep-09 2:09 
AnswerRe: Function out of scope [modified] Pin
Cedric Moonen8-Sep-09 1:17
Cedric Moonen8-Sep-09 1:17 
GeneralRe: Function out of scope Pin
Stuart Dootson8-Sep-09 3:52
professionalStuart Dootson8-Sep-09 3:52 
GeneralRe: Function out of scope Pin
Cedric Moonen8-Sep-09 3:55
Cedric Moonen8-Sep-09 3:55 
GeneralRe: Function out of scope Pin
N a v a n e e t h8-Sep-09 4:22
N a v a n e e t h8-Sep-09 4:22 
GeneralRe: Function out of scope Pin
Joe Woodbury8-Sep-09 5:29
professionalJoe Woodbury8-Sep-09 5:29 
AnswerRe: Function out of scope Pin
Stuart Dootson8-Sep-09 3:55
professionalStuart Dootson8-Sep-09 3:55 
GeneralRe: Function out of scope Pin
Richard MacCutchan8-Sep-09 5:10
mveRichard MacCutchan8-Sep-09 5:10 
Stuart Dootson wrote:
Part of the implied contract of ToStr is that callers will pass the address of a CString object


Not exactly - the original post shows:

CString ToStr()
{
    CString ret = "test";
    return ret;
}

void fun()
{
    CString val = ToStr(); // it returns nothing (bad pointer)
}


The contract here is that ToStr() will return a CString object, which the caller may store or destroy as he/she wishes. The code as written always returns a valid CString object so I don't see how it can fail. However function fun() does nothing with its CString val so that may be where the original problem occurred.
GeneralRe: Function out of scope Pin
Stuart Dootson8-Sep-09 5:43
professionalStuart Dootson8-Sep-09 5:43 
GeneralRe: Function out of scope Pin
Richard MacCutchan8-Sep-09 11:44
mveRichard MacCutchan8-Sep-09 11:44 
GeneralRe: Function out of scope Pin
Moak9-Sep-09 1:21
Moak9-Sep-09 1:21 
QuestionHow to change the font of a button ? Pin
ilgale8-Sep-09 0:52
ilgale8-Sep-09 0:52 
AnswerRe: How to change the font of a button ? Pin
Michael Schubert8-Sep-09 0:58
Michael Schubert8-Sep-09 0:58 
QuestionEM_SETTABSTOPS and tab width in pixels? Pin
Moak8-Sep-09 0:42
Moak8-Sep-09 0:42 
AnswerRe: EM_SETTABSTOPS and tab width in pixels? Pin
Moak8-Sep-09 4:46
Moak8-Sep-09 4:46 
AnswerRe: EM_SETTABSTOPS and tab width in pixels? Pin
ItaniumX29-Jan-10 7:34
ItaniumX29-Jan-10 7:34 
QuestionNon technical C++ question Pin
Ahmed Charfeddine8-Sep-09 0:34
Ahmed Charfeddine8-Sep-09 0:34 
QuestionRe: Non technical C++ question Pin
CPallini8-Sep-09 0:49
mveCPallini8-Sep-09 0:49 
JokeRe: Non technical C++ question Pin
Moak8-Sep-09 0:52
Moak8-Sep-09 0:52 
GeneralRe: Non technical C++ question Pin
Ahmed Charfeddine8-Sep-09 0:54
Ahmed Charfeddine8-Sep-09 0:54 
AnswerRe: Non technical C++ question Pin
Michael Schubert8-Sep-09 1:12
Michael Schubert8-Sep-09 1:12 
QuestionMySQL Can't create an instance of Command Pin
MsmVc8-Sep-09 0:19
MsmVc8-Sep-09 0:19 
AnswerRe: MySQL Can't create an instance of Command Pin
MsmVc8-Sep-09 2:08
MsmVc8-Sep-09 2:08 
GeneralRe: MySQL Can't create an instance of Command Pin
MsmVc8-Sep-09 18:31
MsmVc8-Sep-09 18:31 
QuestionCString count Pin
rdop7-Sep-09 23:19
rdop7-Sep-09 23:19 

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.