To Hazen and Phil:

Here is important additional information concerning the return code
method of implementing an error report system that should make that
method very much easier to maintain and test.

Phil originally expressed concern about the amount of developer time
it would take to implement AND maintain propagation of return codes
through all relevant caller paths, and he also proved my proposed
method of testing potentially would not cover all caller paths.  That
combined with the degree of complexity in the caller paths illustrated
by the doxygen results was also making me concerned about PLplot using
the return code method of error reporting.

However, I just discovered a method with gcc that would make the
implementation and maintenance for that method a lot less of a burden.
That method is as follows (see discussion in
<http://stackoverflow.com/questions/2042780/how-to-raise-warning-if-return-value-is-disregarded-gcc-or-static-code-check>
where the focus is on C++, but the method also works for C):

The method uses the 'warn_unused_result' gcc attribute.  A complication is
that we already use the 'visibility( "default" )' attribute for some
gcc cases in include/pldll.h(.in), and combinations of attributes must
be done with a special attribute list syntax.  So the bottom
line is both the 'warn_unused_result' and 'visibility( "default" )'
attributes would have to be combined appropriately in include/pldll.h(.in)
to form the various PLDLLIMPEXP results there.  And that file would
likely also be the best place to implement the
following

#if defined ( __GNUC__ )
#define PL_WARN_UNUSED __attribute__((warn_unused_result))
#else
#define PL_WARN_UNUSED
#endif

(Note that the PL_WARN_UNUSED macro would be needed for all functions
(e.g., static ones) that don't have some form of PLDLLIMPEXP already
deployed in the PLplot headers.)

So, for example, a static function would be declared as

static PLINT PL_WARN_UNUSED pl<function>

Anyhow, assuming all this 'warn_unused_result' attribute
infrastructure had been set up, then gcc should warn whenever an
attempt is made by C/C++ code that calls a PLplot function to ignore
the return code set by that function.  So this gcc
'warn_unused_result' attribute would be an enormous help in finding
and especially testing and maintaining all caller paths that are
relevant to return code propagation.

Anyhow, because of this (very) recent discovery I am once again
confident of going ahead with an implementation of the return code
method of error reporting (including even memory allocation issues
since the cost of those has suddenly gone down) early in the next
release cyle, and it appears Hazen is ready to help with that
implementation as well.

At the same time I have nothing against the alternative setjmp/longjmp
C exception handling error reporting mechanism favored by Phil except
that I don't completely understand it.  But I would be willing to
follow where Phil actively leads on that so let's hear from Phil about
whether his current time constraints allow him to actively lead (i.e.,
doing some active coding and testing rather than making suggestions
from the side) such a development before we make the final decision
about which error reporting mechanism to use.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to