www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/27/10:48:01

From: Endlisnis <s257m AT unb DOT ca>
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: <Pine DOT SUN DOT 3 DOT 91 DOT 980825152707 DOT 7520j-100000 AT is> <35E4B0FB DOT D8D8AABC AT newnorth DOT net>
NNTP-Posting-Host: fctnts11c20.nbnet.nb.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

<HTML>
<TT>Mike Rusch wrote:</TT>
<BLOCKQUOTE TYPE=CITE><TT>Here's what I've done.</TT>
<BR><TT>First, I tried changing the effstrcpy function to this:</TT><TT></TT>

<P><TT>char *effstrcpy(char * &amp;dest, const char *src) {</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; int slen = strlen(src) + 1;</TT>
<BR><TT>// ---THE NEXT LINE IS LINE 71---</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; malloc(sizeof(char) * slen];</TT></BLOCKQUOTE>
<TT>This line wouldn't compile because it ends in a ']' instead of a ')'
so this obviously isn't the code you ran!&nbsp; Try 'copy' then 'paste'
next time.</TT>
<BLOCKQUOTE TYPE=CITE><TT>I still got a SIGSEV on the malloc line.</TT></BLOCKQUOTE>

<BLOCKQUOTE TYPE=CITE><TT>The 01234567 after "What is your choice?" was
generated by debugging</TT>
<BR><TT>code I inserted just before the call to effstrcpy.&nbsp; It shows
that on the</TT>
<BR><TT>7th call the error occurred (just like before).</TT></BLOCKQUOTE>
<TT>&nbsp;&nbsp;&nbsp; Try making the smallest COMPLETE program which has
this problem, then post it in it's entirety here.</TT>
<BR><TT>--</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; (\/) Endlisnis (\/)</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s257m AT unb DOT ca</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Endlisnis AT GeoCities DOT com</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Endlis AT nbnet DOT nb DOT ca</TT>
<BR><TT>&nbsp;</TT></HTML>



- Raw text -


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