Mail Archives: cygwin/2001/03/14/18:33:01
I compiled the following two sections of code using gcc and g++,
respectively, using the -S switch to create asm source. They both
created almost exactly the same code, with one exception...
"test.c"
int main(void)
{
int i = 0;
for (; i < 100; i++)
i = i * 30 + 4;
return 0;
}
"test.cpp"
int main(void)
{
for (int i = 0; i < 100; i++)
i = i * 30 + 4;
return 0;
}
"test.c.s"
...
L4:
xorl %eax,%eax
jmp L2
.align 4
...
"test.cpp.s"
...
L4:
xorl %eax,%eax
jmp L2
xorl %eax,%eax
jmp L2
.align 4
...
Is the compiler supposed to duplicate those two instructions?
Admittedly, I don't know much about ASM programming, but this
just seemed peculiar to me.
Thanks,
Craig
=====================
Lost on the web? Looking to design your own webpage?
Need information and examples about programming of any
kind from C/C++ to perl and php?
Check out http://www.musitu.org/
-
Don't know all the words to that one song by what's-his-name?
Try http://lyrics.musitu.org/
-
Have a fresh cup of coffee and no newspaper to read?
Browse my stories at http://voices.musitu.org/
=====================
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -