On Tue, Oct 30, 2012 at 5:27 AM, Václav Hapla <span dir="ltr"><<a href="mailto:vaclav.hapla@vsb.cz" target="_blank">vaclav.hapla@vsb.cz</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear all,<br>
I probably don't see something important and I am sorry for that in advance, but anyway I want to make it clear to me:<br>
<br>
What would I spoil by using kind of<br>
TRY( ... );<br>
concept instead of<br>
ierr = ...;CHKERRQ(ierr);<br>
stuff?<br>
The first concept seems to me making the code more readable and is faster to type of course.<br></blockquote><div><br></div><div>There is nothing wrong with that. A small nitpick is that it assumes that ierr is declared.</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have the following two lines in one of my headers included by all C files:<br>
static PetscErrorCode ierr;<br>
#define TRY(f) {ierr = f; CHKERRQ(ierr);}<br>
and the PETSc' error catching system works normally I mean.<br>
<br>
I know of course that for instance following is wrong:<br>
if (something) TRY( somefun1 );<br>
else TRY( somefun2 );<br>
which is a little bit nonintuitive.<br>
<br>
This is not against already existing code; I would just like to understand the reasons - if I am wrong I am about to switch my codebase to the original PETSc' concept.<br>
<br>
Thanks in advance,<br>
BR,<br>
Vaclav<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
<br>
Vaclav Hapla<br>
Research assistant<br>
SPOMECH project <<a href="http://spomech.vsb.cz/" target="_blank">http://spomech.vsb.cz/</a>><br>
Centre of Excellence IT4Innovations <<a href="http://www.it4i.eu/" target="_blank">http://www.it4i.eu/</a>><br>
<br>
VSB-Technical University of Ostrava<br>
17.listopadu 15/2172<br>
708 33 Ostrava-Poruba<br>
Czech Republic<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>