Messages in this thread |  | | | Subject | Re: Egcs 1.0.3 & Linux | | Date | Tue, 19 May 1998 12:04:28 -0400 | | From | David Todd <> |
| |
I asked a very smart friend of mine about this, and he whipped out the ANSI spec.
It turns out that since addition is an associative operation, the compiler is free to reorder the terms for optimization.
Further, he pointed out that you would still have a problem is you had something like:
#include <stdio.h> int a=0; int f(void) { a=1;return 1; } int g(void) { a=2;return 1; } void main(void) { printf("%d",a+f()+g()); } And in my mind f + g should be computed so that they are constants before performing the addition.
In any case the point here is DON'T USE GLOBALS!
Even errno is a bad idea. (Need a solution for that one.) -- Hacksaw = David Charles Todd GTEI-BBNT = Hacksaw's Employer Hacksaw's Opinions != GTEI-BBNT's Opinions Linux understands you.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
|  |