Article View: comp.lang.c++.moderated
Article #73Re: ANSI/ISO Exception Hierarchy
From: Etay Bogner
Date: Tue, 09 Jan 1996 10:06
Date: Tue, 09 Jan 1996 10:06
45 lines
2345 bytes
2345 bytes
X-Original-Date: Tue, 09 Jan 1996 10:22:25 +0200
In article <4crabd$91f@netlab.cs.rpi.edu>, kanze@gabi-soft.fr (J. Kanze) wrote:
>> |> The design of the exception classes has changed since Plauger's book was
>> |> written, and class "exception" no longer has a member function "raise".
>> |> The exception classes now have only
>> |> default constructor
>> |> copy constructor
>> |> assignment operator
>> |> virtual destructor
>> |> virtual function "const char* what() const;"
>>
>> |> The "what" function returns an implementation-defined null-terminated
>> |> character string.
I would suggest that it will return a :
typeid(*this).name()
as the standard default behavior. This way we don't add another global
string to the executable's data area, and we re-use the already existing
string ( which represents the name of the exception ).
>> Does this include the constructors? I don't see where this is stated in
>> the draft, and as most of the constructors (except bad_alloc and
>> bad_exception) take a reference to a string, I would expect them to
>> invoke the copy constructor for string, which I presume *can* throw
>> bad_alloc.
I believe that the string class would best implememnted as a
copy-on-change class, which means that the copy-constructor will not
actually duplicate the string but will increase the reference counter it
uses.
- --
- -- Etay Bogner,
- -- Etay_Bogner@mail.stil.scitex.com,
- -- Scitex Corp.
- -- Israel.
[ comp.lang.c++.moderated is a moderated newsgroup. Submit articles ]
[ to <c++-submit@netlab.cs.rpi.edu>. The moderation policy can be ]
[ retrieved from <http://netlab.cs.rpi.edu/~cppmods/guide.html>. ]
[ Moderators can be reached at: c++-request@netlab.cs.rpi.edu. ]
Technical Details
Message-ID:
<4cteo4$32o@netlab.cs.rpi.edu>Path:
arc1-ca.pugleaf.net!library.erc.clarkson.edu!rpi!not-for-mailReferences:
<4cgog4$jsq@netlab.cs.rpi.edu> <4cipio$pcj@netlab.cs.rpi.edu> <4crabd$91f@netlab.cs.rpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!library.erc.clarkson.edu!rpi!not-for-mail From: Etay_Bogner@mail.stil.scitex.com (Etay Bogner) Newsgroups: comp.lang.c++.moderated,comp.std.c++ Subject: Re: ANSI/ISO Exception Hierarchy Date: 9 Jan 1996 10:06:59 -0000 Organization: Scitex Corp. Sender: cppmods@netlab.cs.rpi.edu Approved: kanze@lts.sel.alcatel.de Message-ID: <4cteo4$32o@netlab.cs.rpi.edu> References: <4cgog4$jsq@netlab.cs.rpi.edu> <4cipio$pcj@netlab.cs.rpi.edu> <4crabd$91f@netlab.cs.rpi.edu> NNTP-Posting-Host: netlab.cs.rpi.edu