This is a discussion on Re: C++ exceptions - KDE ; --===============0277749268== Content-Type: multipart/signed; boundary="nextPart2287172.931Vd4dERK"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart2287172.931Vd4dERK Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Monday 05 December 2005 14:02, Guillaume Laurent wrote: > Michael Buesch wrote: > > It is all about _coding_ in a clean way.=20 ...
--===============0277749268==
Content-Type: multipart/signed;
boundary="nextPart2287172.931Vd4dERK";
protocol="application/pgp-signature";
micalg=pgp-sha1
Content-Transfer-Encoding: 7bit
--nextPart2287172.931Vd4dERK
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
On Monday 05 December 2005 14:02, Guillaume Laurent wrote:
> Michael Buesch wrote:
> > It is all about _coding_ in a clean way.=20
> Indeed. So show us how to rewrite the following in a clean way with=20
> return codes :
>=20
> 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.
> }
>=20
> //...
>=20
> try {
> writeFile();
> } catch (DiskFullException e) {
> error("disk is full");
> }
=2D-=20
Greetings Michael.
--nextPart2287172.931Vd4dERK
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQBDlEDVlb09HEdWDKgRAlLoAJ9shP8objRO9IiJzhgkSW BBfPBiuACfS+A2
wtIyjTJEvQPnHDlwKJVj8Dk=
=I84C
-----END PGP SIGNATURE-----
--nextPart2287172.931Vd4dERK--
--===============0277749268==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
--===============0277749268==--