Re: [xml] -fexceptions



On Wed, Jul 30, 2003 at 09:29:07AM +0200, Murray Cumming Comneon com wrote:
From: Graham Bennett [mailto:graham-libxml simulcra org] 
It would be 
very useful to
be able to throw from SAX callbacks when using libxml from C++.

libxml++ has a solution for this without rebuilding libxml:
http://libxmlplusplus.sourceforge.net.

I have looked at this and there are a few problems with libxml++ from my
point of view (these might not hold any longer).

 - exception handling solution requires callbacks to throw only
   exceptions that derive from the libxml++ exception type.  If anything
   else is thrown then problems will occur if -fexceptions isn't turned
   on.  I think at least libxml++ should catch (...) and throw a generic
   exception, for safety's sake.  In my environment it's not practical
   to catch all possible exceptions and rethrow without losing
   information about the original exception.

 - the sax callback interface doesn't expose quite as much information
   as I can get from using libxml directly.

 - in the libxml++ design, I am paying for virtual function calls for
   every callback, which I would rather avoid.

 - libxml++ doesn't treat extern "C" properly.  the functions it
   registers in the libxml sax handler struct should be declared extern
   "C" but aren't.  This seems to be fine with g++, but other compilers
   (correctly) report that the type of the function pointer in the struct
   is different to the type of the function pointer being passed.

 - finally I couldn't get libxml++ to compile with the sun c++ compiler,
   although I didn't try too hard.

cheers,

-- 
Graham Bennett



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]