
Robert Kawulak:
You can eliminate the try/catch from the code. For example, instead of:
try { // do sth dangerous using cmpRead } catch(...) { cmpRead = 0; throw; }
write:
auto tmp = cmpRead; cmpRead = 0; // do sth dangerous using tmp cmpRead = tmp;
Hi, Robert, Thanks for that. I tried it. The implementation is available here -- http://webEbenezer.net/misc/rcb.hh . It's one line shorter than the version with the try/catch, but it adds 3 minor statements to the non-error path. On Fedora 14 with g++ 4.5.1 one of my executables increased in size by over 500 bytes when using the version without a try/catch. On Windows 7 with MSVC++ 10 there wasn't any size difference in the executable. I find the try/catch version easier to understand though. -- Brian Wood Ebenezer Enterprises http://webEbenezer.net