delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/23/16:24:10

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Standard tiiming func's & 03+ cause odd errors
Date: Fri, 18 Jul 1997 07:40:43 -0400
Organization: Cornell University http://www.cornell.edu
Lines: 42
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <33CF563B.2CA8@cornell.edu>
References: <33CF0E4F DOT 7F0B AT lausd DOT k12 DOT ca DOT us>
Reply-To: asu1 AT cornell DOT edu
NNTP-Posting-Host: cu-dialup-0046.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

csantill AT lausd DOT k12 DOT ca DOT us wrote:
 
> fps=7680/((t[2]-t[1])/UCLOCKS_PER_SEC)
>                 or
> fps=7680/((t[2]-t[1])/CLOCKS_PER_SEC)
> 
> This is odd because it does not occur when I compile
> w/O0 or O1.

>   clock_t t[2];

no, it is not odd, because depending on the optimization mode, the
garbage you are addressing with t[2] will be different. i guess, in the
first two optimization modes, nothing touches the number you put there
and -O3, gets corrupted.

just to remind you what this is about: in C array indexes start from 0
and go up to n - 1 for an array of size n.

btw, the code i sent you is very primitive, and you certainly would not
want to fill a screen with the overhead of both a function call, and a
segment switch each time. when you get your measuring stuff right, you
can take a look at the farns functions, and try to re-write putpixel as
a macro, then use those to measure the overhead from the function calls
and segment switches.

one advice: try saying "my code causes odd errors when combined with
-O3". if it is not your code it will come out. but, if you first start
looking any other place than your own code, you are going to miss a lot
of bugs.

-- 
   Sinan
 
*******************************************************************
 A. Sinan Unur                                WWWWWW
                                              |--O+O
 mailto:sinan DOT unur AT cornell DOT edu                C   ^ 
 http://www.people.cornell.edu/pages/asu1/     \  ~/ 

Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************

- Raw text -


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