Topic: xmsg and string classes


Author: pete@genghis.interbase.borland.com (Pete Becker)
Date: Mon, 27 Jun 1994 21:20:34 GMT
Raw View
In article <2u6p9e$fsi@vixen.cso.uiuc.edu>,
Harry Miller <hmiller@osiris.cso.uiuc.edu> wrote:
>I've just started looking at exception handling and I ran across
>something in the xmsg class that does not seem to be the best way
>to write classes for a library.
>
>The class xmsg uses the ANSI C++ string class to store the message
>that can be used for exception reporting.  Well the way that I
>understand library designs (I'm just learning about this) is that
>use of external algorithms (classes, structs, functions) should only
>be done with a specific design goal in mind (reuse, flexibility, etc.).
>It seems to me that xmsg could just use char * instead of string.  Then
>the user does not need to link in the code for the string class if it
>is not needed elsewhere.
>

 When string is used in xmsg, the user does not need to link in the code
for handling char *'s if it not needed elsewhere.
 -- Pete







Author: hmiller@osiris.cso.uiuc.edu (Harry Miller)
Date: 21 Jun 1994 13:17:34 GMT
Raw View
I've just started looking at exception handling and I ran across
something in the xmsg class that does not seem to be the best way
to write classes for a library.

The class xmsg uses the ANSI C++ string class to store the message
that can be used for exception reporting.  Well the way that I
understand library designs (I'm just learning about this) is that
use of external algorithms (classes, structs, functions) should only
be done with a specific design goal in mind (reuse, flexibility, etc.).
It seems to me that xmsg could just use char * instead of string.  Then
the user does not need to link in the code for the string class if it
is not needed elsewhere.

Is there a specific reason why string is used instead of char *?
If I understand exceptions (most likely not :-) ) there is some
unusual memory requirements for throwing exceptions that are not
dynamically allocated.  Is this why string was used, to help simplify
exception passing?

I would appreciate an explanation as to why this is.  I will also
accept flames about being an idiot, fool, or not knowing what I'm
talking about (most likely!!!).  Also I'll accept flames about being
bold enough to question Stroustrup's design of the xmsg class (I'm
pretty sure he is the designer of exceptions (right?)).


Harry E. Miller ----------------- just a jerk lurking on the net
hmiller@osiris.cso.uiuc.edu ----- where to send the hate mail

Ask about a job opertunity at the Institute of Quantum Oceanography.
All applicants must be able to briefly what the term Quantum
Oceanography means!