delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/10/05/21:51:41

Date: 5 Oct 94 11:53 -0700
From: Philip Hodder <hodder AT geop DOT ubc DOT ca>
To: <djgpp AT sun DOT soe DOT clarkson DOT edu>
Subject: Very strange behaviour! Please help!

Hi all,

	I've run across a really wierd bug - at least I think it's a bug. I
have no idea what's going on! To save space I won't post the whole code but the
essence of it is:


	do {
		ShowImg();

 		switch (getkey()) {
                  /* do some stuff */
		}

		if (flag) {
		  /* do some other stuff */
		  SomeFunction();
		}
	} while ()

It crashes in ShowImg() BUT if I change it to 

		if (flag) {

		  SomeFunction();

		  printf(" "); fflush(stdout);
		}

it works! And it works as I wanted it to. If I comment out the printf... stuff
then it will compile the same but crash. (SomeFunction() doesn't print anything
out.) This seems almost unbelievable - I can't imagine why having a printf call
can affect anything! Can anyone help me out here? This is with version 1.12m2.

	Yours in bewilderment!

		Phil.

------------------------------------------------------------------------------
Philip J. C. Hodder                               INTERNET: hodder AT geop DOT ubc DOT ca
Dept. of Geophysics & Astronomy                   PHONE:    (604) 822-6722 
#129-2219 Main Mall                               FAX:      (604) 822-6047
University of British Columbia           
Vancouver, BC,              
Canada  V6T 1Z4               URL: http://www.astro.ubc.ca/~hodder/hodder.html
------------------------------------------------------------------------------
"The further thought occurs that we haven't budged a smegging inch!"
						           - Rimmer, Red Dwarf
------------------------------------------------------------------------------


- Raw text -


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