Skip to content

Instantly share code, notes, and snippets.

@ruslo
Created September 9, 2015 19:51
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/05989fd4f807ae79671e to your computer and use it in GitHub Desktop.
Save ruslo/05989fd4f807ae79671e to your computer and use it in GitHub Desktop.
### No reference test
> cat a.cpp
int foo(int a) {
return a + 3;
}
> g++ -O3 a.cpp -c -o a.o
> objdump -d a.o
0000000000000000 <_Z3fooi>:
0: 8d 47 03 lea 0x3(%rdi),%eax
3: c3 retq
### Test with reference
> cat a.cpp
int foo(const int& a) {
return a + 3;
}
> g++ -O3 a.cpp -c -o a.o
> objdump -d a.o
0000000000000000 <_Z3fooRKi>:
0: 8b 07 mov (%rdi),%eax
2: 83 c0 03 add $0x3,%eax
5: c3 retq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment