cat t.c
int main()
{
if ("foo" == "foo") {
return 1;
} else {
return 0;
}
}
>cat t.s
.file "t.c"
.def ___main; .scl 2; .type 32; .endef
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
andl $-16, %esp
call ___main
movl $1, %eax
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
LFE0:
gcc -S is your friend, gcc removed the if statement and just returned 1
>>6
implying gcc compilation is fast to begin with
and no C doesn't compare strings with ==, go back to C++ you moron. == compares pointer values in that case. but as you can see gcc removes it anyway since it knows it'll always return 1