Click here to Skip to main content
16,018,114 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Oh No... Not again!!! Pin
vijay_aroli29-Jan-08 23:35
vijay_aroli29-Jan-08 23:35 
GeneralRe: Oh No... Not again!!! Pin
Cranky29-Jan-08 23:53
Cranky29-Jan-08 23:53 
GeneralTo remove the data from a file. Pin
Chandrasekharan P29-Jan-08 20:45
Chandrasekharan P29-Jan-08 20:45 
GeneralRe: To remove the data from a file. Pin
Cedric Moonen29-Jan-08 20:55
Cedric Moonen29-Jan-08 20:55 
QuestionRe: To remove the data from a file. Pin
Rajesh R Subramanian29-Jan-08 22:16
professionalRajesh R Subramanian29-Jan-08 22:16 
QuestionDll fucntions called in EXE ! Pin
lgatcodeproject29-Jan-08 20:42
lgatcodeproject29-Jan-08 20:42 
GeneralRe: Dll fucntions called in EXE ! Pin
Cedric Moonen29-Jan-08 20:59
Cedric Moonen29-Jan-08 20:59 
Generalexception handling, function call and memory Pin
George_George29-Jan-08 20:33
George_George29-Jan-08 20:33 
Hello everyone,


Such code segment is used to check whether function call or exception-handling mechanism runs out of memory first (written by Bjarne),

void perverted()
{
    try{
        throw exception();
    }
    catch (exception& e)
    {
        perverted();
        cout << e.what() << endl;
    }
}


1.

My question is when the exception is thrown, and goes to exception handler in catch block, it will do operations in the following sequences,

(1) execute the exception handler code (since there will be recursive function call -- stack will ever increasing);
(2) unwind stack.

Runs out of memory because function call will make stack ever-increasing, right?

If it does (2) before (1), I think stack will always be unwinded before exception handling is called -- then stack will never grow, so there will be no out-of-memory caused by an ever increasing stack.

Is that correct?

2.

I am confused about why exception handling mechanism will run out of memory because in exception handle implementation, we just insert exception handler registration block of the function onto the beginning of the new function call stack each time there is a function call, so the memory should be the memory consumed by function call stuff, I do not think exception handling mechanism itself will consume additional memory. How do you think of it and how do you think of the what are the memory consumed by exception handling mechanism?


thanks in advance,
George
GeneralRe: exception handling, function call and memory Pin
CPallini29-Jan-08 21:21
mveCPallini29-Jan-08 21:21 
GeneralRe: exception handling, function call and memory Pin
Maxwell Chen29-Jan-08 21:25
Maxwell Chen29-Jan-08 21:25 
QuestionRe: exception handling, function call and memory Pin
CPallini29-Jan-08 21:27
mveCPallini29-Jan-08 21:27 
GeneralRe: exception handling, function call and memory Pin
Maxwell Chen29-Jan-08 21:29
Maxwell Chen29-Jan-08 21:29 
GeneralRe: exception handling, function call and memory Pin
George_George29-Jan-08 21:49
George_George29-Jan-08 21:49 
GeneralRe: exception handling, function call and memory Pin
CPallini29-Jan-08 22:04
mveCPallini29-Jan-08 22:04 
GeneralRe: exception handling, function call and memory Pin
George_George29-Jan-08 23:30
George_George29-Jan-08 23:30 
Generalstruct and union difference Pin
gentleguy29-Jan-08 20:04
gentleguy29-Jan-08 20:04 
GeneralRe: struct and union difference Pin
Maxwell Chen29-Jan-08 20:19
Maxwell Chen29-Jan-08 20:19 
GeneralRe: struct and union difference Pin
Rajesh R Subramanian29-Jan-08 20:33
professionalRajesh R Subramanian29-Jan-08 20:33 
JokeThank you very mutch, man Pin
CPallini29-Jan-08 21:16
mveCPallini29-Jan-08 21:16 
JokeRe: Thank you very mutch, man Pin
Cedric Moonen29-Jan-08 21:19
Cedric Moonen29-Jan-08 21:19 
JokeRe: Thank you very mutch, man Pin
Rajesh R Subramanian29-Jan-08 22:20
professionalRajesh R Subramanian29-Jan-08 22:20 
GeneralNeed Help on c and c++ merging Pin
manish.patel29-Jan-08 19:49
manish.patel29-Jan-08 19:49 
QuestionRe: Need Help on c and c++ merging Pin
Maxwell Chen29-Jan-08 20:04
Maxwell Chen29-Jan-08 20:04 
GeneralRe: Need Help on c and c++ merging Pin
manish.patel29-Jan-08 20:06
manish.patel29-Jan-08 20:06 
GeneralRe: Need Help on c and c++ merging Pin
Maxwell Chen29-Jan-08 20:18
Maxwell Chen29-Jan-08 20:18 

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.