Fun with C
Consider the following little program:
int main()
{
int x[10];
int i;
for (i=0; i <= 10; i++){
x[i] = 0;
}
return 0;
}
What happens if you compile without optimization?
gcc -o t t.cThink about it before you actually run it! What is the difference if you compile with optimization in gcc?
gcc -o t t.c -O1
1 Comments:
Depends on the way the compiler allocates the variables on the stack and whether the compiler performs any optimizations, such as loop unrolling.
2:56 PM
Post a Comment
<< Home