Re: A89: Clearing a string
[Prev][Next][Index][Thread]
Re: A89: Clearing a string
The use of an unnecesary 'continue' has no effect on TI-GCC's output at
all. I'm not really sure why people here expect TI-GCC to screw up where
computer compilers don't, as the C compiler of TI-GCC is none other than
GCC, which is the standard compiler on Linux systems, and also used on
other PC systems as well (e.g. for the DOS version of Quake). Actually,
TI-GCC probably is a bit worse, as version 2.95 of GCC does generate
better code (in some cases) than the one TI-GCC uses. Also, the 68000
code generation of GCC seems slightly worse than on the x86. However,
TI-GCC certainly can do all of the extremely obvious optimizations.
As an example, when compiled with -O2 -S, all the following functions
generate identical code:
int function1(int x, int y)
{
int z;
z = 20;
while (--z) {
if (y == -2)
break;
x += y-- * z;
}
return x;
}
int function2(int x, int y)
{
int z;
for (z = 20; ((--z) && (y != -2)); x += y-- * z);
return x;
}
int function3(int x, int y)
{
int z;
for (z = 20; ((--z) && (y != -2)); x += y-- * z)
continue;
return x;
}
References: