www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/20/12:45:39

Message-ID: <37446063.57ECA93A@rocketmail.com>
From: Denis Lamarche <brainwav AT rocketmail DOT com>
Organization: @Home Network
X-Mailer: Mozilla 4.05 [en]C-AtHome0404 (Win95; U)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: pointer/loop problem
Lines: 36
Date: Thu, 20 May 1999 16:22:56 GMT
NNTP-Posting-Host: 24.112.228.171
X-Complaints-To: abuse AT home DOT net
X-Trace: news2.rdc1.on.home.com 927217376 24.112.228.171 (Thu, 20 May 1999 09:22:56 PDT)
NNTP-Posting-Date: Thu, 20 May 1999 09:22:56 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am making a game with allegro:

typedef struct tagANIM
{
double clock;
unsigned char *next;
}ANIM;

ANIM *anims;

Then I load all the data into the anim structure (by malloc'ing ) its a
basic linked list.
ok then in some parts of my program I go like this:


ANIM *t;
t=(ANIM *)anims;

do
  {
  t->clock++;
  [alot of code here]
  }while(!ENDGAME);

Ok...heres the problem....everytime I run the program it gives me an
error.  I can trace it back to t->clock++, but if I remove the do/while
loop...it works perfectly. (but I need the loop).  If I fix one then the
error is then loacted at another point in the program, but in a sub that
has the same loop as above.

I think its whatever statement that is right after the DO that will
error.  if I put t->clock++ before the DO loop wvwrything is fine.   Has
anyone ever experienced this?


Denis Lamarche

- Raw text -


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