[MOAB-dev] rval errors
Nico Schlömer
nico.schloemer at gmail.com
Tue Nov 24 20:05:53 CST 2015
Hi everyone,
I just sat down to fix a bunch of coverity warnings about using
uninitialized fields, unchecked return values etc. I couldn't help but
notice that the return-value strategy for error interception is flawed.
It's not done by default, and if you actually check it, it clutters up the
code like
```
ErrorCode rval
rval = do_something(foo, bar);
MB_CHK_ERR(rval);
```
Also, function that naturally return void have to return `int`, and in fact
no function can return anything else _but_ `int` if it wants to do error
checking.
Needless to say, this policy isn't followed strictly (in constructure, for
example, you even cannot return an int, thus cannot check for errors
MOAB-style).
I'm sure you're all aware of it, but I would like you to know that this is
leading to actual errors: Inserting some MB_CHK_ERRs here and there lead me
to a failing test. I still need to dig out what exactly is the cause, but I
suspect a failing MB_CHK_ERR.
The fix for all this clearly are exceptions.
Cheers,
Nico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20151125/9fce99af/attachment.html>
More information about the moab-dev
mailing list