[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: SAX/C++: C++-specific design principles

  • From: "Mark D. Anderson" <mda@d...>
  • To: xml-dev@i...
  • Date: Mon, 06 Dec 1999 14:14:38 -0800

c exception class design

>> - use C++ exceptions
> 
> I vote for C++ exceptions. That is why they are there.

Someone should dictate whether the exception objects are raised,
or pointers to them. Regardless, it is impossible for mere mortals
to use them without having leaks when they occur below constructors
and destructors. But I guess anyone using C/C++ already knows they
are taking such risks.

Don't get me wrong; i like exceptions in programming languages that
support them well.

I'm a little confused by the intent of the draft header, where
there is a SAXParseException class which is an argument to a handler.
Seems like if it is a native C++ exception, then the caller takes
care of catching it, not registering a handler.

I also wonder whether a handler (error handler or any other, like
document) is supposed to be able to call back into the Parser
and tell it clean up.

I also might note that the current exception class appears to have
no member data indicating which parser or inputsource object is in use,
which would be an issue with a multi-threaded implementation, or
even a single-threaded one with multiple top-level instances.

> 
>> btw, i'd like to register an objection to reference args. they make
>> code reading a bit of pain because you cannot tell from the call whether
>> a copy constructor is going to be used or not -- you always have to
>> go hunt up the .h. with a pointer arg, it is always clear.
> 
> If you always pass by reference, this isn't a problem. In C++, there is
> almost never a compelling reason to pass objects by value.

Agreed. I guess it comes down to how much you trust other programmers.
If you trust them, then using pointerhood to encode optionality might
be useful. I guess I'm just too often forced to deal with C++ afficionados
who love nothing more than hiding several automatic class methods and
casts in every argument value.

-mda


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.