Click here to Skip to main content
15,885,869 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Choosing which information that Windows Vista's folder contents displayer is to display Pin
David Crow21-Mar-13 6:14
David Crow21-Mar-13 6:14 
GeneralRe: Choosing which information that Windows Vista's folder contents displayer is to display Pin
Anthony Appleyard21-Mar-13 7:49
Anthony Appleyard21-Mar-13 7:49 
GeneralRe: Choosing which information that Windows Vista's folder contents displayer is to display Pin
David Crow21-Mar-13 7:58
David Crow21-Mar-13 7:58 
GeneralRe: Choosing which information that Windows Vista's folder contents displayer is to display Pin
Anthony Appleyard21-Mar-13 11:05
Anthony Appleyard21-Mar-13 11:05 
GeneralRe: Choosing which information that Windows Vista's folder contents displayer is to display Pin
David Crow21-Mar-13 17:01
David Crow21-Mar-13 17:01 
QuestionRAII Theory Pin
Richard Andrew x6421-Mar-13 1:52
professionalRichard Andrew x6421-Mar-13 1:52 
AnswerRe: RAII Theory Pin
Stephen Hewitt21-Mar-13 6:41
Stephen Hewitt21-Mar-13 6:41 
AnswerRe: RAII Theory Pin
pasztorpisti22-Mar-13 3:41
pasztorpisti22-Mar-13 3:41 
In theory you can think of an exception as if it was a "big return" from many functions to the catch part of the nearest try block in your callstack. Both in case of a an exception and a normal return you want to release resources that are on the stack frame of the returning function(s). This is where RAII is very useful, by applying it your code will be more brief/visually pleasing, and it is usually much more invulnerable by later changes. Lets say you find a bug and fix it with an error message and a return - but what happens if you forget to free already allocated resources... With RAII this is usually not a problem.

Again, using exceptions and returning values are two very similar ways to report results (not only errors!!!) to the caller. Its a fact that exceptions are used mostly for error handling, I think this is because error-free execution usually doesn't require "multiple returns". Some examples on exceptions whos purpose is not "error reporting" to the caller: Abort exception in Delphi: a silent exception to escape to the nearest catch block, it's silent because it doesn't log errors or show error message boxes even if you don't catch it. Its an easy way for example to escape from the whole "button press" event handler no matter how deep is the callstack. Anoter example is the SystemExit exception of python. If you call sys.exit(0) it doesn't terminate the interpreter!!! Instead it thorws a SystemExit exception that isnt necessarily an error (especially when you exit with zero).
GeneralRe: RAII Theory Pin
Stephen Hewitt22-Mar-13 21:17
Stephen Hewitt22-Mar-13 21:17 
GeneralRe: RAII Theory Pin
pasztorpisti23-Mar-13 1:06
pasztorpisti23-Mar-13 1:06 
GeneralRe: RAII Theory Pin
Stephen Hewitt24-Mar-13 8:27
Stephen Hewitt24-Mar-13 8:27 
GeneralRe: RAII Theory Pin
pasztorpisti24-Mar-13 8:44
pasztorpisti24-Mar-13 8:44 
GeneralRe: RAII Theory Pin
pasztorpisti24-Mar-13 8:52
pasztorpisti24-Mar-13 8:52 
QuestionFunction pointer Pin
Marco Bertschi21-Mar-13 0:10
protectorMarco Bertschi21-Mar-13 0:10 
AnswerRe: Function pointer Pin
Richard MacCutchan21-Mar-13 0:51
mveRichard MacCutchan21-Mar-13 0:51 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 1:06
protectorMarco Bertschi21-Mar-13 1:06 
GeneralRe: Function pointer Pin
Richard Andrew x6421-Mar-13 1:57
professionalRichard Andrew x6421-Mar-13 1:57 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 2:16
protectorMarco Bertschi21-Mar-13 2:16 
GeneralRe: Function pointer Pin
Freak3021-Mar-13 2:30
Freak3021-Mar-13 2:30 
GeneralRe: Function pointer Pin
Marco Bertschi21-Mar-13 2:36
protectorMarco Bertschi21-Mar-13 2:36 
GeneralRe: Function pointer Pin
dusty_dex21-Mar-13 4:21
dusty_dex21-Mar-13 4:21 
GeneralRe: Function pointer Pin
Richard MacCutchan21-Mar-13 3:28
mveRichard MacCutchan21-Mar-13 3:28 
QuestionProblem regarding to array in C++ Pin
achylast20-Mar-13 22:00
achylast20-Mar-13 22:00 
AnswerRe: Problem regarding to array in C++ Pin
Richard MacCutchan20-Mar-13 22:48
mveRichard MacCutchan20-Mar-13 22:48 
QuestionRe: Problem regarding to array in C++ Pin
achylast25-Mar-13 15:36
achylast25-Mar-13 15:36 

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.