Related to the issue of throwing exceptions to
C++ and other modern application environments on
errors is providing some sort of restart handling
within POPT itself.

In C this is usually done using setjmp(3)/longjmp(3).

Note that POPT has always had a rather primitive method
to restart implemented in

        /** \ingroup popt
         * Reinitialize popt context.
         * @param con           context
        void poptResetContext(/*...@null@*/poptContext con)
                /*...@modifies con @*/;

so it would not be very hard to tie the already implemented "reinitialize"
method into a setjmp(3)/longjmp(3) exception handling framework.

With a little thought, I believe I can likely add other restart
points within option/arg handling, its just another stack (and
POPT already has 2 stacks now in the process of being unified
into one. Adding a dynamic run-time element such as implied
by setjmp(3)/longjmp(3) is largely adding another token to
a union "item" which is pushed/popped accirding to well-defined

(aside to the aside)
There's other automagic doing, say, cleanup using atexit(3)
that would simplify using POPT's API as well (and get
POPT off of everyone's bleeping widdle valgrind exercise
hit lists without forcing me to debug everyone's POPT
bugs ad nauseum.

I can go many ways here. Some exception handling framework
is needed for POPT to be easily used in modern languages
like C++/Java/... and (in C) this means setjmp(3)/longjmp(3)/atexit(3).


73 de Jeff

POPT Library                                 
Developer Communication List             

Reply via email to