Click here to Skip to main content
15,914,323 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalerror C2593: 'operator >>' is ambiguous Pin
BobTheProgrammer28-Jun-04 23:23
BobTheProgrammer28-Jun-04 23:23 
GeneralRe: error C2593: 'operator >>' is ambiguous Pin
*Dreamz30-Jun-04 4:52
*Dreamz30-Jun-04 4:52 
GeneralSetProcessDefaultLayout() Pin
Mohammad Adel28-Jun-04 23:13
Mohammad Adel28-Jun-04 23:13 
GeneralRe: SetProcessDefaultLayout() Pin
Anders Molin29-Jun-04 1:37
professionalAnders Molin29-Jun-04 1:37 
GeneralErros how to solve these Pin
Anonymous28-Jun-04 22:51
Anonymous28-Jun-04 22:51 
GeneralRe: Erros how to solve these Pin
rrrado28-Jun-04 23:07
rrrado28-Jun-04 23:07 
GeneralRe: Erros how to solve these Pin
Xzyx987X28-Jun-04 23:07
Xzyx987X28-Jun-04 23:07 
Generaladding Libs now only warnings Pin
Anonymous28-Jun-04 23:27
Anonymous28-Jun-04 23:27 
QuestionHow to open dr.watson's .wlg file in win xp? Pin
rrrado28-Jun-04 22:37
rrrado28-Jun-04 22:37 
GeneralSetProcessDefaultLayout() Pin
Mohammad Adel28-Jun-04 22:37
Mohammad Adel28-Jun-04 22:37 
GeneralWindows xp Pin
sirtimid28-Jun-04 21:57
sirtimid28-Jun-04 21:57 
GeneralRe: Windows xp Pin
OBRon29-Jun-04 3:04
OBRon29-Jun-04 3:04 
GeneralUse of extern Pin
sweep12328-Jun-04 21:46
sweep12328-Jun-04 21:46 
GeneralRe: Use of extern Pin
Xzyx987X28-Jun-04 22:24
Xzyx987X28-Jun-04 22:24 
GeneralRe: Use of extern Pin
sweep12328-Jun-04 22:33
sweep12328-Jun-04 22:33 
GeneralRe: Use of extern Pin
Xzyx987X28-Jun-04 23:01
Xzyx987X28-Jun-04 23:01 
GeneralRe: Use of extern Pin
sweep12328-Jun-04 23:22
sweep12328-Jun-04 23:22 
GeneralRe: Use of extern Pin
Rick York29-Jun-04 6:16
mveRick York29-Jun-04 6:16 
GeneralRe: Use of extern Pin
Johnny ²29-Jun-04 4:48
Johnny ²29-Jun-04 4:48 
GeneralAnimateWindow() Question Pin
User 58385228-Jun-04 21:37
User 58385228-Jun-04 21:37 
GeneralSetting up Visual C++ .NET to break on a windows error Pin
Xzyx987X28-Jun-04 20:48
Xzyx987X28-Jun-04 20:48 
QuestionWay to Prevent memeory leak? Pin
nachilau28-Jun-04 20:29
nachilau28-Jun-04 20:29 
Hello all,

I have a question on about how to prevent to prevent the memory leak? I am writing a window program, and I have an Assert() so that if any fatal erorr occured, the Assert() will call
Sleep(INFIITE) to stop the program, and print out the error message to the user. By doing that, the only way to exit the program after Assert() has been called is to close the window. However, it causes a problem which is that even though the desturctor of each classes in the program will be called when the user close the window, there may still some memory leak in the local scoop when I use Assert() like this, eg in funciton f()

f() {
char* name = new char[10];
Assert(AnyError(), "Fatal Error!");
strcpy(name, "Hello");
delete [] name;
}

For example, if I get the Assert() if I get any error in f(), then when the user close the window, I will have a memory leak for 10 bytes. What is the best way to solve the problem? I don't want to use the try and catch block since the code will be mess up with all those try and catch block. And I really want to stop the program when the fatal error occurs. Any ideas? Thanks!



Nacho
AnswerRe: Way to Prevent memeory leak? Pin
User 58385228-Jun-04 20:43
User 58385228-Jun-04 20:43 
GeneralRe: Way to Prevent memeory leak? Pin
nachilau28-Jun-04 21:09
nachilau28-Jun-04 21:09 
GeneralRe: Way to Prevent memeory leak? Pin
User 58385228-Jun-04 21:34
User 58385228-Jun-04 21:34 

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.