Linked by Eugenia Loli-Queru on Fri 8th Sep 2006 04:08 UTC
Thread beginning with comment 160627
To view parent comment, click here.
To read all comments associated with this story, please click here.
To view parent comment, click here.
To read all comments associated with this story, please click here.





Member since:
2005-07-06
... Yeah, sure, exception is much more powerful.
If you need fine grained error recovery, instead of doing:
int err;
..
if ((err = command(...)) < 0) {
/* Fine grained error recovery. */
err = errno;
goto out;
}
You do:
int previous_err = 0;
int err = 0;
...
if (!previous_err) {
try {
command(...);
}
catch (...) {
// Fine gained error recovery.
...
// No goto. We don't do such things in
// CPP. Lets us just do if previous_err
// 128 times till the end of the function.
previous_err = err;
}
}
<SARCASM>
Yep, indeed C++ exception is much better at fine-grained error recovery then C
is.
Thank God kernels and OS libraries are still written in C!
</SARCASM>
- Gilboa
* Sorry about that... I'm just faced, on a daily basis, by herd of C++ programmers who throw C++ on each stupid error, failing to do any type of error recovery and leaving all the clean up to the CPP/C libraries/drivers/etc.
Edited 2006-09-08 21:47