Skip to content

Instantly share code, notes, and snippets.

@ruslo
Created September 9, 2015 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruslo/976b25256330fa8ef4de to your computer and use it in GitHub Desktop.
Save ruslo/976b25256330fa8ef4de to your computer and use it in GitHub Desktop.
### No reference test
> cat a.cpp
int boo(int);
int foo(int a) {
return boo(a);
}
> g++ -O3 a.cpp -c -o a.o
> objdump -d a.o
0000000000000000 <_Z3fooi>:
0: e9 00 00 00 00 jmpq 5 <_Z3fooi+0x5>
### Test with reference
> cat a.cpp
int boo(const int&);
int foo(int a) {
return boo(a);
}
> g++ -O3 a.cpp -c -o a.o
> objdump -d a.o
0000000000000000 <_Z3fooi>:
0: 48 83 ec 18 sub $0x18,%rsp
4: 89 7c 24 0c mov %edi,0xc(%rsp)
8: 48 8d 7c 24 0c lea 0xc(%rsp),%rdi
d: e8 00 00 00 00 callq 12 <_Z3fooi+0x12>
12: 48 83 c4 18 add $0x18,%rsp
16: c3 retq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment