Mail Archives: djgpp/1997/07/23/16:24:10
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 -