Есть некая функция:
void Foo() {
auto_ptr<int> Ptr1;
auto_ptr<int> Ptr2();
auto_ptr<int> Ptr3(0);
}
После трансляции получается (VC6):
621: auto_ptr<int> Ptr1;
004266C7 6A 00 push 0
004266C9 8D 4D E8 lea ecx,[ebp-18h]
004266CC E8 D9 AE FD FF call @ILT+1445(std::auto_ptr<int>::auto_ptr<int>) (004015aa)
004266D1 C7 45 FC 00 00 00 00 mov dword ptr [ebp-4],0
622: auto_ptr<int> Ptr2();
623: auto_ptr<int> Ptr3(0);
004266D8 6A 00 push 0
004266DA 8D 4D E0 lea ecx,[ebp-20h]
004266DD E8 C8 AE FD FF call @ILT+1445(std::auto_ptr<int>::auto_ptr<int>) (004015aa)
004266E2 C6 45 FC 01 mov byte ptr [ebp-4],1
Почему
auto_ptr<int> Ptr2();
не транслируется, а Ptr3(0) транслируется? Ведь в конструкторе auto_ptr по умолчанию тоже 0 используется.
explicit auto_ptr(_Ty *_P = 0)