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:
Anonymous2006-09-27 16:51
Oh god
....
...
Gee I wonder if it has anything to do with that semicolon at the end of the first line in my for loop. Why the fuck did I put that there? Why did I not even notice it until I posted this and made an ass out of myself?
Removing it fixes the problem. And I'm able to use for (float t = blahblahblah)...
oh god why does this happen
Name:
Anonymous2006-09-27 17:48
It happened because you put your opening brace on a separate line, and instinctively you put a semicolon before the Enter.
This thread is now about ALLMAN STYLE SUCKS.
Name:
Anonymous2006-09-27 18:40
Accept thread change
Let's take a look at the four major styles:
GNU style: if ()
{Shit sux fag. Who's the moron who came up with this shit? It's fugly, serves no practical purpose, wastes a line of text per loop making less code fit in your screen thus harder to read / more scrolling, and is harder to type. They managed to combine all the disadvantages of any style.
Whitesmiths style: if ()
{Kinda ugly, and you waste one line. Plus 8 spaces per tab is ridiculous, 4 should have been the standard since the beginning of time.
Allman style: if ()
{Even worse than Whitesmiths because it looks uglier, and it's even easier to make the semicolon mistake than the previous two were, since the next line starts in the same column.
K&R style: if () {Two gods, one true style. Finally, something that looks good, uses fewer lines, can't be mistaken for a non-block, and is easiest to type. The original tabs were 8 spaces, again, this is bad, but K&R style with 4 space tabs (or what's better, real tabs configured to show 4 spaces) is the best.
Name:
Anonymous2006-09-27 18:41
The code tag fails hard, even though I had newlines before and after all my opening and closing tags.
Name:
Anonymous2006-09-27 19:28
I prefer Allman style simply because my curly braces are aligned to the same column, so it makes it easier for me to see which ones match up to the other.
Name:
Anonymous2006-09-27 20:40
syntax doesn't do shit. Only amateurs whine about it.
Name:
Anonymous2006-09-27 21:08
DO YOUR OWN HOMEWORK FAGGOT
Name:
Anonymous2006-09-27 21:57
it's because you have a semicolon at the end of your for loop. the part in the braces is only run once.
>>6
If you indent K&R properly, the closing brace will match with the opening block, and more importantly, the code inside a block is indented so no problem with it.
Or too stupid to ever catch his own mistakes, oblivious moron.
Name:
Anonymous2006-09-29 3:34
>>14
Is an idiot. Seriously, people who don't understand basic syntax for loops shouldn't be programming.
Name:
Anonymous2006-09-29 7:19
I'm sorry, but I think that >>13 is right, thought maybe a little harsh. I've had syntax problems with C/C++, but I've never done that to a for loop, while loop, if/else statement, etc.
And it has nothing to do with code-style like >>3 implies.
Name:
Anonymous2006-09-29 8:35
Everybody who doesn't use Allman style needs to GB2 his 24 line terminal and off my Internet.
Name:
Anonymous2006-09-29 11:14
A.) People who use Allman style do so because it makes their curly braces line up, making the start and end of blocks easier to see.
B.) In K&R style, the closing curly brace still lines up with something -- the actual opening construct. Which means you can just as easily find the start of the block, AND you don't have to visually move up another line to find out what the hell that block IS. The inside of the block is still indented. It also saves you a keystroke and a line on screen.
People who use Allman style are using a style with absolutely no advantages over K&R.
Name:
Anonymous2006-09-29 12:36
>>17
This post is offtopic, remember the thread is about ALLMAN STYLE SUCKS.
>>1
God you're such a fucking failure. I immediately saw the extra semicolon after the for statement.
STOP FAILING SO HARD, GO BACK TO USING A FUCKING SCRIPT LANGUAGE LIKE PYTHON OR RUBY BECAUSE C IS OBVIOUSLY TOO *MANLY* FOR YOU.
Name:
Anonymous2006-09-29 22:45
>>20
There is no reason to use doubles unless you are writing some microscale simulation to be run on a supercomputer. Few things need that much precision, and they are slow for real time applications.