Click here to Skip to main content
16,006,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting addresses...setjmp/longjmp Pin
Aescleal13-Jun-10 22:37
Aescleal13-Jun-10 22:37 
GeneralRe: Getting addresses...setjmp/longjmp Pin
_AnsHUMAN_ 13-Jun-10 22:47
_AnsHUMAN_ 13-Jun-10 22:47 
GeneralRe: Getting addresses...setjmp/longjmp Pin
_AnsHUMAN_ 14-Jun-10 19:03
_AnsHUMAN_ 14-Jun-10 19:03 
GeneralRe: Getting addresses...setjmp/longjmp Pin
Aescleal15-Jun-10 0:21
Aescleal15-Jun-10 0:21 
GeneralRe: Getting addresses...setjmp/longjmp Pin
_AnsHUMAN_ 15-Jun-10 1:51
_AnsHUMAN_ 15-Jun-10 1:51 
GeneralRe: Getting addresses...setjmp/longjmp Pin
Aescleal15-Jun-10 8:35
Aescleal15-Jun-10 8:35 
GeneralRe: Getting addresses...setjmp/longjmp Pin
norish14-Jun-10 9:17
norish14-Jun-10 9:17 
GeneralRe: Getting addresses...setjmp/longjmp Pin
Aescleal14-Jun-10 9:34
Aescleal14-Jun-10 9:34 
That's not what the author wanted - he wanted to be able to implement something like co-routines or resumable exceptions with his code (which is why set/longjmp attracted him, he could branch from an arbitrary lump of code back to another arbitrary lump). Exceptions are just good for a one way trip up the call stack.

Oh, and as an aside - if you use C++ exceptions follow the rule "throw by value, catch by reference." The last thing you want to be doing is resource management when you're trying to handle exceptions - it's complete madness. And if you think I'm talking complete rubbish consider what happens if printSomething throws - you'll leak a pointer to a TException object.

And I've just noticed you're using that cardinal sin void main(). Guess what? That doesn't compile on any standard conforming C++ compiler. Use one of the two standard forms instead:

int main()


or:

int main( int argv, char *argv[] )


Ash
GeneralRe: Getting addresses...setjmp/longjmp Pin
norish14-Jun-10 10:07
norish14-Jun-10 10:07 
GeneralRe: Getting addresses...setjmp/longjmp Pin
Aescleal14-Jun-10 11:08
Aescleal14-Jun-10 11:08 
QuestionSendMessage and PostMessage Pin
Pryabu13-Jun-10 20:23
Pryabu13-Jun-10 20:23 
AnswerRe: SendMessage and PostMessage Pin
«_Superman_»13-Jun-10 20:27
professional«_Superman_»13-Jun-10 20:27 
GeneralRe: SendMessage and PostMessage Pin
Pryabu13-Jun-10 20:53
Pryabu13-Jun-10 20:53 
GeneralRe: SendMessage and PostMessage Pin
«_Superman_»13-Jun-10 20:57
professional«_Superman_»13-Jun-10 20:57 
GeneralRe: SendMessage and PostMessage Pin
Pryabu13-Jun-10 21:02
Pryabu13-Jun-10 21:02 
AnswerRe: SendMessage and PostMessage Pin
rp_suman13-Jun-10 20:33
rp_suman13-Jun-10 20:33 
AnswerRe: SendMessage and PostMessage Pin
KarstenK13-Jun-10 21:17
mveKarstenK13-Jun-10 21:17 
QuestionCustom Radio Control Pin
AbhiHcl13-Jun-10 19:22
AbhiHcl13-Jun-10 19:22 
AnswerRe: Custom Radio Control Pin
«_Superman_»13-Jun-10 19:38
professional«_Superman_»13-Jun-10 19:38 
AnswerRe: Custom Radio Control Pin
Niklas L13-Jun-10 20:28
Niklas L13-Jun-10 20:28 
GeneralRe: Custom Radio Control Pin
AbhiHcl13-Jun-10 21:21
AbhiHcl13-Jun-10 21:21 
GeneralRe: Custom Radio Control Pin
Niklas L14-Jun-10 3:00
Niklas L14-Jun-10 3:00 
GeneralRe: Custom Radio Control Pin
AbhiHcl14-Jun-10 19:29
AbhiHcl14-Jun-10 19:29 
QuestionHow to open a registry key that contains space? Pin
pubis13-Jun-10 8:45
pubis13-Jun-10 8:45 
AnswerRe: How to open a registry key that contains space? Pin
Niklas L13-Jun-10 9:05
Niklas L13-Jun-10 9:05 

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.