Boost logo

Boost Users :

Subject: [Boost-users] boost exception tutorial
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-03-29 14:25:49


I'm investigating boost exception to see if it is helpful in a particular
instance. I start by looking at the first Tutorial.

I can't see how this is better than

struc my_error : public std::exception {
    int m_ errno;
    my_error(int errno) :
        m_errno(errno)
    {}
};

... throw my_error(errno)

try {
    ...
}
catch(my_error e){
    cerr << e;
}

What am I missing here? This first example is two compilicated in that it
requires that I delve into a bunch of other stuff (operator << for exception
data?) and it doesn't provide any motivation. I think it would be more
useful if it "spoon fed" the reader (me in this case) a little more.
Something like:

Traditional simple example like that above.
explanation of why the example isn't "good enough"
simple example reformulated using boost exception
explanation of how this addresses the short comings of the original version.

I think this would motivate more users to transition to the library.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net