Re: Inlined functions



> All distros, save for say Gentoo, inline only functions explicitly asked
> to be inlined.
>
> No additional compile-time inlining occurs.

Really?

--------------------------------------------------------------------
welinder anemone:~> cat i.c
static int
foo (void)
{
  return 42;
}

int
main (int argc, char **argv)
{
  return foo ();
}
welinder anemone:~> gcc -Wall -O2 -S i.c
welinder anemone:~> cat i.s
        .file   "i.c"
        .text
        .p2align 4,,15
.globl main
        .type   main, @function
main:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %eax
        pushl   %eax
        movl    $42, %eax
        andl    $-16, %esp
        subl    $16, %esp
        leave
        ret
        .size   main, .-main
        .section        .note.GNU-stack,"",@progbits
        .ident  "GCC: (GNU) 3.3.5 20050117 (prerelease) (SUSE Linux)"
--------------------------------------------------------------------

I want my foo back!

M.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]