From 4529178175302700066
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,55e1f95e6a02519c
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,55e1f95e6a02519c
X-Google-Attributes: gidf78e5,public
From: mikey@mcs.com
Subject: Re: Function try blocks
Date: 1995/05/22
Message-ID: <3ppaj7$9v5@News1.mcs.com>#1/1
X-Deja-AN: 103027364
references: <smeyersD8wut1.2LK@netcom.com> <3pmpr2$nol@Mars.mcs.com> <smeyersD8xyM3.A4z@netcom.com>
organization: Fen Software, Inc.
mime-version: 1.0
newsgroups: comp.std.c++,comp.lang.c++

In article <smeyersD8xyM3.A4z@netcom.com>, smeyers@netcom.com says...
>
>| address_ and phones_ are both pointers; you can safely assign them to NULL
>| in ctors. The constructor body should take care of allocation. NULL
>
>You you can't: they're const pointers in the original posting.  The only
>way to give them a value is in a member init list.  And if an exception is
>thrown during their initialization, you can't safely delete them.
>
---------------
Hmmm. So they are. Just the same, I know no other way to safely destroy them when an 
exception gets thrown. You can cast away const-ness in the constructor body, or you might 
re-evaluate the need for const on the private copy.

Mike.




