[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: C++ exceptions
From: Michael Buesch <mbuesch () freenet ! de>
Date: 2005-12-05 13:29:56
Message-ID: 200512051429.57064.mbuesch () freenet ! de
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
On Monday 05 December 2005 14:02, Guillaume Laurent wrote:
> Michael Buesch wrote:
> > It is all about _coding_ in a clean way.
> Indeed. So show us how to rewrite the following in a clean way with
> return codes :
>
> void writeFile() {
> writeHeader();
> writeContent();
> writeFooter();
What if the exception raises in writeFooter()? Don't you want
to unwind writeContent() and writeHeader()?
Maybe not in this particular case, but _if_ you have to unwind it?
Insert try/catch blocks into writeFile()? Or how would you solve this?
This is a real question, no flamewar.
> }
>
> //...
>
> try {
> writeFile();
> } catch (DiskFullException e) {
> error("disk is full");
> }
--
Greetings Michael.
[Attachment #5 (application/pgp-signature)]
>> 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