www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/03/08:30:33

From: sparhawk AT eunet DOT at (Gerhard Gruber)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Moving variable down in class fixes crash...
Date: Thu, 03 Sep 1998 09:54:46 GMT
Organization: EUnet Austria
Lines: 39
Message-ID: <35f250c2.941056@news.Austria.EU.net>
References: <35EE4E1A DOT 5EAD70B5 AT geocities DOT com>
NNTP-Posting-Host: e058.dynamic.vienna.at.eu.net
Mime-Version: 1.0
NNTP-Posting-Date: 3 Sep 1998 09:56:32 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Destination: spiritseeker <spiritseeker AT geocities DOT com>
From: Gruber Gerhard
Group: comp.os.msdos.djgpp
Date: Thu, 03 Sep 1998 10:06:50 +0200:

>I have this simple class:
>
>class::sprite {
>public:
>  long x,y;
>  long type;
>  BITMAP *frame; // yep, i'm using allegro 8-)
>  // and some more stuff below..
>}
>
>Before I added the "long type" everything was fine but now the program
>crashes. However, if I move the "long type" below the "BITMAP *frame"
>everything's working again. Why is this?

Usually this kind of error indicates that you overwrite the stack somwehere.
This type of error is hard to track. :) You can try to insert printf()
somewhere along the code, because this changes also the stack, and then see if
it crashes. If it does then move the printf() upward (logically) in your code
until the no longer happens and the real error should be around that spot.

Probably somebody else has a better idea.

--
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