www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/04/18:54:09

From: sparhawk AT eunet DOT at (Gerhard Gruber)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Crash in class when adding new variables
Date: Fri, 04 Sep 1998 22:30:54 GMT
Organization: EUnet Austria
Lines: 49
Message-ID: <35fd5f72.48706033@news.Austria.EU.net>
References: <35eec1db DOT 0 AT 195 DOT 158 DOT 64 DOT 19> <35f0e017 DOT 37639438 AT news DOT Austria DOT EU DOT net> <35f01ace DOT 0 AT 195 DOT 158 DOT 64 DOT 19>
NNTP-Posting-Host: e083.dynamic.vienna.at.eu.net
Mime-Version: 1.0
NNTP-Posting-Date: 4 Sep 1998 22:32:44 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Destination: "Mars" <mars AT homemail DOT com>
From: Gruber Gerhard
Group: comp.os.msdos.djgpp
Date: 4 Sep 1998 18:52:30 +0100:

>It was not me.  This is another problem.

Oh. Same subject line different problem. :)

>This is the signiture of the class:

Well, the calls is with 99.9% surity (is this the word?) not the problem.
Rather your problem lies somewhere in your code. I'm pretty sure that you
overwrite your stack somewhere and thats why changes in the class might crash
your program. Because the stack layout is different with the new class and it
happens that the new values crash whereas the previous values went unnoticed
(but are still there). So check your code for parts where you use automatic
variables (specifically arrays) where you might go beyond array boundaries.

Something like that might cause your problem:

foo()
{
   char s[5];

   strcpy(s, "Very long string doesnt fit in this short array");
}

Another problem might be that you are shooting with wild pointers. :) Are you
sure you initialized all pointers prior to using them? Assigning a default
value of NULL often helps in detecting such errors. I'd recommend to do this
on all pointers.

--
Bye,
   Gerhard

email: sparhawk AT eunet DOT at
       g DOT gruber AT sis DOT co DOT at

Spelling corrections are appreciated.

- Raw text -


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