- C++ error handling -> error is rare -> throw and forget - 1 Update
- pointer to pointer to const - 2 Updates
- I need a CPU core exclusively for one thread - 1 Update
wij <wyniijj5@gmail.com>: Jul 16 02:27PM -0700 Snippet from https://www.geeksforgeeks.org/exception-handling-c/ #include <iostream> using namespace std; // Here we specify the exceptions that this function // throws. void fun(int *ptr, int x) throw (int *, int) // Dynamic Exception specification { if (ptr == NULL) throw ptr; if (x == 0) throw x; /* Some functionality */ } int main() { try { fun(NULL, 0); } catch(...) { cout << "Caught exception from fun()"; } return 0; } Note : The use of Dynamic Exception Specification has been deprecated since C++11. One of the reasons for it may be that it can randomly abort your program. This can happen when you throw an exception of another type which is not mentioned in the dynamic exception specification. Your program will abort itself because in that scenario, it calls (indirectly) terminate(), which by default calls abort(). ------------ "Caught exception from fun()" is not guaranteed (an illusion). Even throw specification would survive, the context loss problem is still unsolved. "Throw (std?)'exception' and let the caller knows how to deal with it deals with it" ... How convenient the "Advanced error handling mechanism" is! LIE, or like olcott, he did not know he kept lying all these years. |
red floyd <no.spam.here@its.invalid>: Jul 15 04:43PM -0700 On 7/15/2023 4:23 AM, David Brown wrote: [redacgted] > post (especially without snipping), you are circumventing these filters > and spreading his spam to people who otherwise manage to avoid it. So > please do not do this. Thanks. Didn't realize he was a troll, had never seen him before. |
Anand Hariharan <mailto.anand.hariharan@gmail.com>: Jul 15 07:18PM -0700 On Wednesday, May 25, 2005 at 8:02:58 PM UTC, Morten Frederiksen wrote: > limitation on the compiler. > Regards > Morten Frederiksen This is a FAQ: https://isocpp.org/wiki/faq/const-correctness#constptrptr-conversion best, - Anand |
red floyd <no.spam.here@its.invalid>: Jul 15 04:42PM -0700 > students were using it at the same time it often collapsed in a heap and had to > be rebooted. Also at the time (I'm sure they fixed it at some point) in the > early 90s it was vulnerable to fork bombs. They'd crash it instantly. In the early 80s, we had VAX-780s at UCSC, running 4.2BSD (not Open/Net/FreeBSD, just straight from Berkeley BSD). At the end of the semester one year, we got one of them up to a load average in the 70s. The thing slowed to a crawl, but... IT. DID. NOT. CRASH. Period. Rock solid. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment