[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: C++ exceptions
From: Guillaume Laurent <glaurent () telegraph-road ! org>
Date: 2005-12-05 13:44:26
Message-ID: 4394443A.5070208 () telegraph-road ! org
[Download RAW message or body]
Matthias Granberry wrote:
> error_t writeFile() {
> error_t err;
> if( (err = writeHeader()) || //this stops processing on the first error
> (err = writeContent()) ||
> (err = writeFooter() ) )
> return err;
> return 0;
> }
>
Yes, but do you really think this is as readable and maintainable as the
version using exceptions ?
> Having said this, exceptions are very useful in situations where the problem
> gets a little deeper or you have a more than a few levels of indirection
> present
Yes, that's why I choose a fairly basic error in my example which must
be handled at the topmost level of the application. I wasn't going to
write half a dozen of functions just for a sample :-).
> but as Thiago pointed out earlier they come with a price so they
> should be used with care.
>
I totally agree.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic