hello
I have changed title slightly because I thought this is more appropriate question.
Would you refactor it (seems like legitimate use of goto) ? If, how would you refactor the following code to remove go to statement?
if (data.device) {
try {
...
}
catch(const std::exception&) { goto done; }
... // more things which should not be caught
done: ;
}
complete statement
#ifdef HAVE_GPU
// attempt to use GPU device
if (data.device) {
try {
Integral::Gpu eri(S, R, Q, block.shell());
eri(basis.centers(), quartets, data.device);
}
// if GPU fails, propagate to cpu
catch(std::exception) { goto done; }
data.device += size;
host_index.extend(block_index);
block_index.data.clear();
done: ;
}
#endif
thank you
after have seen preference of most, I decided to go with flag, but with Mr. York comment.
Thank you everybody