•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 402,547 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,304 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 1746 | Replies: 4
![]() |
Can someone please explain to me just exactly this try/catch is doing? It doesn't seem to make any sense to me. Thank you in advance.
case '\r': if (Choice==(CancelIndex+1))return; try{(*Action[Choice-1])();} catch(...){} system("cls"); Choice = 1; break; case char(27): if ((CancelIndex+1)==ItemCount)return; try{(*Action[ItemCount-1])();} catch(...){} Choice = 1; break;
Education is what remains after one has forgotten what one has learned in school.
Well, it has a legitimate purpose. The author probably didn't want exceptions to propagate beyond this scope. Without the catch, the unhandled exception would just go on until it hits the first catch or until it goes all the way out of the call stack, in which case the terminate function is called.
I'm not a fan of swallowing exceptions silently (at the very least it should be logged), but I wouldn't call it half-hearted either.
I'm not a fan of swallowing exceptions silently (at the very least it should be logged), but I wouldn't call it half-hearted either.
I'm a programmer. My attitude starts with arrogance, holds steady at condescension, and ends with hostility. Get used to it.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- 'catch' without 'try' (Java)
- How to catch Datagrid error (C#)
- catch and throw (C#)
- problem - one catch block to other catch block of same try block (C)
- try catch and finnaly (Java)
Other Threads in the C++ Forum
- Previous Thread: Need Help With a Loop!!
- Next Thread: how to find highest and lowest number..



Linear Mode