Код: Выделить всё
#include
struct Foo { int a; };
static int A;
void
func_shared(const boost::shared_ptr &foo) {
A = foo->a;
}
void
func_raw(Foo * const foo) {
A = foo->a;
}
Код: Выделить всё
Disassembly of section .text:
00000000 :
0: 55 push ebp
1: 89 e5 mov ebp,esp
3: 8b 45 08 mov eax,DWORD PTR [ebp+8]
6: 5d pop ebp
7: 8b 00 mov eax,DWORD PTR [eax]
9: a3 00 00 00 00 mov ds:0x0,eax
e: c3 ret
f: 90 nop
00000010 :
10: 55 push ebp
11: 89 e5 mov ebp,esp
13: 8b 45 08 mov eax,DWORD PTR [ebp+8]
16: 5d pop ebp
17: 8b 00 mov eax,DWORD PTR [eax]
19: 8b 00 mov eax,DWORD PTR [eax]
1b: a3 00 00 00 00 mov ds:0x0,eax
20: c3 ret
Компиляция с помощью g++ 4.1.2, -O3 -NDEBUG.
Подробнее здесь: https://stackoverflow.com/questions/248 ... ereference
Мобильная версия