|
|
"Thorsten Froehlich" <tho### [at] trfde> wrote:
> This is under Linux, of course. It may just be a library issue that
doesn't
> exist under Windows. gcc surely is not such a good compiler...
... but not such a bad compiler, either. In general, VC surpasses GCC in
terms of code quality (especially fp), of course, but consider this sample
code (I stumble upon such things, at times, as I actively use both gcc and
VC++), gcc 2.95.3-5 vs. MSC/C++ 12.00.8168 (VS 6.0):
----- test.c:
typedef struct { short a; char b, c; } D;
D func( void )
{
D d = { 1, 2, 3 };
return d;
}
----- test.bat:
@echo off
gcc -c -S -O2 -fomit-frame-pointer test.c
cl -c -FA -Ox -nologo test.c
----- test.s:
_func:
movl $50462721,%eax
ret
----- test.asm (_d$ = -4):
_func PROC NEAR
push ecx
mov WORD PTR _d$[esp+4], 1
mov BYTE PTR _d$[esp+6], 2
mov BYTE PTR _d$[esp+7], 3
mov eax, DWORD PTR _d$[esp+4]
pop ecx
ret 0
Post a reply to this message
|
|