From: Charles Krug Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP -> possible bug Date: Fri, 09 Jan 1998 09:34:33 -0500 Lines: 28 Message-ID: <34B63578.91618208@pentek.com> References: <34B50E12 DOT 441C AT oce DOT nl> NNTP-Posting-Host: mail.pentek.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk A. Jans-Beken wrote: > As an exercise I made my own string class (from the book of Stroustrup). > I wrote a testprogram too and it appears that the operator+= results in > an abnormal program termination. > You didn't supply your += operator, so let me guess--you're not reallocating your string when you change its length. When you get to the end of your string buffer, you start overwriting memory that doesn't belong to you, with "unpredictable and undesirable" results. Take a look at your += operator, and make sure you're handling your memory allocation correctly. You may find it useful to make a member method to handle memory allocation and call it from all the appropriate places. -- Charles Krug, Jr. Application Engineer Pentek Corp 1 Park Way Upper Saddle River, NJ 07458