delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/27/05:21:30

From: manni DOT heumann AT gmx DOT de (Manni Heumann)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: new gnu 'new'' bug ?
Date: 27 Jan 2001 10:08:57 GMT
Lines: 36
Message-ID: <Xns9036718F7F5EDmanniheumanngmxde@130.133.1.4>
References: <3A72A43B DOT 1217 AT earthlink DOT net>
NNTP-Posting-Host: pec-126-24.tnt4.h2.uunet.de (149.225.126.24)
X-Trace: fu-berlin.de 980590137 16059436 149.225.126.24 (16 [54749])
User-Agent: Xnews/M3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019