Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

what the FUCK?

Name: Anonymous 2006-09-27 16:48

I've been programming in C++ for a long, long time and I have never come across this particular problem before.

Here's the problem area in the code:

  float t = 0;

  for (t = 0.0f; t < 1.0f; t += 0.1f);
  {
    Q3.slerp(Q1, Q2, t);

    cout << t << "] " << Q3.w << "(" << Q3.x << ", "
         << Q3.y << ", " << Q3.z << ") " << endl;
  }

I just wanted to write a simple test program that outputs a series of values of a Quaternion that's SLERPed between two quaternions.

The problem is ONLY TIME ANYTHING IS OUTPUT TO STDOUT is at the VERY LAST ITERATION!!

I tried it with printf, too, and still the same thing.  I tried flush(stdout) as well as cout << flush in different parts of the loop, no such luck.

And I know that it is indeed looping because, say, if I change the third clause in the for loop to something like t += 0.000000001 it sits for a while, so I know it is actually going through the loop.

Why is cout and printf not printing jack shit until the loop is finished?

Also, optimizations are turned off.  I'm using gcc 4.0.0.  On another note, it won't let me declare:

for (float t = 0.0; t < 1.0f; t += 0.1f)

because it says I can't declare variables in the for loop, I had to do "float t" beforehand.  BULL SHIT.  Every other C++ compiler in existence lets me do this, and I know for a fact that doing so is allowed in the ISO standard.

But nevermind that, my real problem is why it isn't printing output within the loop until only the very last iteration.  What the hell is going on?

Name: moot !Ep8pui8Vw2 2006-09-28 1:09

>>9
THIS is why I hate C.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List