Click here to Skip to main content
15,908,675 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGetUserProfileDirectory Pin
Fareed Rizkalla13-Jul-10 15:37
Fareed Rizkalla13-Jul-10 15:37 
AnswerRe: GetUserProfileDirectory Pin
Richard MacCutchan13-Jul-10 21:59
mveRichard MacCutchan13-Jul-10 21:59 
Questionget logon and logoff event in an service on windows 2000 Pin
EverettJF13-Jul-10 15:05
EverettJF13-Jul-10 15:05 
Question10 & 10/3*3 are not equal ! ! ! WHY? Pin
hasani200713-Jul-10 9:32
hasani200713-Jul-10 9:32 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
Maximilien13-Jul-10 9:55
Maximilien13-Jul-10 9:55 
GeneralRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
Niklas L14-Jul-10 1:13
Niklas L14-Jul-10 1:13 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? PinPopular
Niklas L13-Jul-10 9:56
Niklas L13-Jul-10 9:56 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
EverettJF13-Jul-10 14:47
EverettJF13-Jul-10 14:47 
GeneralRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
Rick York13-Jul-10 16:32
mveRick York13-Jul-10 16:32 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
Aescleal13-Jul-10 21:47
Aescleal13-Jul-10 21:47 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
josda100014-Jul-10 6:26
josda100014-Jul-10 6:26 
QuestionDLL injection at start time. Pin
Code-o-mat13-Jul-10 6:13
Code-o-mat13-Jul-10 6:13 
QuestionWord automation using MFC - how to hide Word toolbar and menu bar Pin
Member 422150713-Jul-10 4:46
Member 422150713-Jul-10 4:46 
QuestionUsing Open SSL Pin
Rajmohan SK13-Jul-10 3:54
Rajmohan SK13-Jul-10 3:54 
AnswerRe: Using Open SSL Pin
Aescleal13-Jul-10 4:11
Aescleal13-Jul-10 4:11 
GeneralRe: Using Open SSL Pin
Rajmohan SK13-Jul-10 17:57
Rajmohan SK13-Jul-10 17:57 
Questionconst string reference variables Pin
apphia_j_7913-Jul-10 2:43
apphia_j_7913-Jul-10 2:43 
AnswerRe: const string reference variables Pin
Cedric Moonen13-Jul-10 2:47
Cedric Moonen13-Jul-10 2:47 
GeneralRe: const string reference variables Pin
apphia_j_7913-Jul-10 3:24
apphia_j_7913-Jul-10 3:24 
GeneralRe: const string reference variables Pin
Cedric Moonen13-Jul-10 3:32
Cedric Moonen13-Jul-10 3:32 
QuestionRe: const string reference variables Pin
CPallini13-Jul-10 2:58
mveCPallini13-Jul-10 2:58 
AnswerRe: const string reference variables Pin
Aescleal13-Jul-10 3:52
Aescleal13-Jul-10 3:52 
AnswerRe: const string reference variables Pin
Niklas L13-Jul-10 4:42
Niklas L13-Jul-10 4:42 
You should check the string before sending it to Reset, or the object owning the string. Taking its reference might be ok even if the instance no longer exists, but once you dereference it, you might get an access violation.

Typically, problems like this occurs if your string is a member variable in an instance you have deleted (or is null).

class A
{
    string s;
public:
    void method() { Reset(s); }
};
A *a = nullptr;
a->method();


The above code will work when Reset() takes a reference to the string, but not if it accesses its value, which a call-by-value does.

QuestionC2782 Pin
T.RATHA KRISHNAN13-Jul-10 1:47
T.RATHA KRISHNAN13-Jul-10 1:47 
AnswerRe: C2782 Pin
Cedric Moonen13-Jul-10 2:09
Cedric Moonen13-Jul-10 2:09 

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.