From: Endlisnis Newsgroups: comp.os.msdos.djgpp Subject: Re: keyword "new" causes SIGSEV Date: Thu, 27 Aug 1998 11:00:37 -0300 Organization: NBTel Internet Lines: 30 Message-ID: <35E56685.9ECA9A63@unb.ca> References: <35E4B0FB DOT D8D8AABC AT newnorth DOT net> NNTP-Posting-Host: fctnts11c20.nbnet.nb.ca Mime-Version: 1.0 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Mike Rusch wrote:
Here's what I've done.
First, I tried changing the effstrcpy function to this:

char *effstrcpy(char * &dest, const char *src) {
    int slen = strlen(src) + 1;
// ---THE NEXT LINE IS LINE 71---
    malloc(sizeof(char) * slen];

This line wouldn't compile because it ends in a ']' instead of a ')' so this obviously isn't the code you ran!  Try 'copy' then 'paste' next time.
I still got a SIGSEV on the malloc line.
The 01234567 after "What is your choice?" was generated by debugging
code I inserted just before the call to effstrcpy.  It shows that on the
7th call the error occurred (just like before).
    Try making the smallest COMPLETE program which has this problem, then post it in it's entirety here.
--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT GeoCities DOT com
          Endlis AT nbnet DOT nb DOT ca