Mail Archives: djgpp/2001/01/27/05:21:30
Shelby Worley <sworley AT earthlink DOT net> wrote on 27 Jan 2001:
[snip]
> // String:: a simple string class consisting of a
> (1)pointer // to a dynamically allocated
> 0-terminated string, // the (2) string
> length, and (3) the allocated total //
> memory.
>
> String a, b, c, d;
> // code giving user selected codes to b,c,d
> a = b + c + d; // Program issues a SIGSEGV
[snip]
Well it seems, that you (at least) forgot to mention (4)
operator+.
[snip]
> The problem occurred by the action of the copy
> constructor for string.
Did you also forget (5) string (const string&) ? Or are you
referring to the default copy c'tor?
It seems that we need to see a little code from your class. In
particular:
- the c'tor String()
- the copy c'tor
- the operator +
Of course, the versions of your compiler and library wouldn't
hurt, either.
Manni
- Raw text -