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

C programming tricks

Name: Anonymous 2007-09-15 22:06 ID:WCtjqT0N

While programming optimization that makes ones' code completely unreadable is often a bad thing, there are places for it, like that one inner loop of your code that takes up 98% of the program's running time.

What are you tricks for improving performance in C, other than the obvious inline assembly or the like?

Name: Anonymous 2008-01-08 19:52

>>124
Actually, it's invalid C.
It invokes undefined behavior in the assignment and calls a function that is not standard without providing declaration and definition. (the non-standard function is random btw)

let's see the assignment:
*s=f[random()%2](*s++);
As you might know, in such assignment the compiler is free to evaluate the RHS or the LHS first.
If LHS is evaluated first and then RHS what happends?
That's right motherfucker. Undefined behavior.
Fucking C fag, gtfo /prog/ and read SICP.

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