RE: [boost] RE: Re: Standard C Library and C++ / BOOST

Vladimir Prus wrote:
The error_storage::failed() function has the hard-coded check, but the errorcheck class gets the storage (and check) policy as a template, so you can provide your own class to perform a custom check.
I suppose it comes down to what you are used to and aesthetics. I have been using MS COM objects heavily that rely on HRESULT error code returns, where the code looks like: HRESULT hr; IHTMLStyle * s = 0; if( FAILED( hr = elem -> get_style( &s ))) goto clean; // use the style object clean: if( elem != 0 ) elem -> Release(); if( s != 0 ) s -> Release(); Which is ugly IMHO, so I use a smart pointer for COM object management and have a com::hresult class for storing the HRESULT, mapping it to a string, etc. The errorcheck class is based on a com::result (throwing version of com::hresult) now defined using errorcheck: typedef boost::errorcheck< hresult > result; I suppose there are applications for both approaches, depending on what style you want, what facilities you want, etc. Regards, Reece _________________________________________________________________ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger
participants (1)
-
Reece Dunn