Re: how to pass params to inline functions by reference or value?

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

 



John Fine wrote:

> All that assumes the compiler really does take your suggestion of
> "inline".  As someone else already mentioned, "inline" is just a
> suggestion.  If the code weren't inlined then the optimizer could not
> avoid the copy operation.

That is what "static inline" or "__attribute__((always_inline))" is for.

Tony Wetmore wrote:

> I have used the following command-line in the past to generate assembly
> alisting files (with integrated source):
> 
>    gcc -c -g -O3 -Wa,-adhls=func.list func.c
> 
> As part of the assembly process, the "func.list" file is generated,
> containing the source and assembly, like so:

That is one way, you can also use objdump:

objdump -drwS func.o

This of course requires that func.o was compiled with debug info (-g),
otherwise there's no source line information.  Note that when looking at
the disassembly output of an unlinked object it's easy to get confused
if you don't pay attention to relocs, as e.g. jump targets and function
calls are all encoded as zero in the opcode, as the linker has not run
yet.  But the actual symbolic location is encoded in the reloc, and with
-r objdump should make this clear enough.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux