Boost logo

Boost :

From: David Freer (dave_freer_at_[hidden])
Date: 2002-06-12 14:29:49


The following simple code produces no executable code with MSVC 6 SP4 using
the boost shared pointer. Any Ideas?

class dog
{
    public:
        int hairless;
        double weight;
};

void somefunction()
{
    typedef boost::shared_ptr<dog> t_spDog;
    t_spDog toby( new dog ); // ok
    toby = new dog; // this line produces no warnings but no executable code
as well.
    toby = t_spDog( new dog ); // ok
}

Disassembly while debugging -
148: t_spDog toby( new dog );
00402134 movsx edx,word ptr [__LINE__Var (004185c8)]
0040213B add edx,0Eh
0040213E push edx
0040213F push offset THIS_FILE (00418520)
00402144 push 10h
00402146 call operator new (00404680)
0040214B add esp,0Ch
0040214E mov dword ptr [ebp-1Ch],eax
00402151 mov eax,dword ptr [ebp-1Ch]
00402154 push eax
00402155 lea ecx,[toby]
00402158 call @ILT+495(boost::shared_ptr<dog>::shared_ptr<dog>) (004011f4)
0040215D mov dword ptr [ebp-4],0
149:
150: toby = new dog;
151:
152: toby = t_spDog( new dog );
00402164 movsx ecx,word ptr [__LINE__Var (004185c8)]
0040216B add ecx,12h
0040216E push ecx
0040216F push offset THIS_FILE (00418520)
00402174 push 10h
00402176 call operator new (00404680)
0040217B add esp,0Ch
0040217E mov dword ptr [ebp-28h],eax
00402181 mov edx,dword ptr [ebp-28h]
00402184 push edx
00402185 lea ecx,[ebp-24h]
00402188 call @ILT+495(boost::shared_ptr<dog>::shared_ptr<dog>) (004011f4)
0040218D mov dword ptr [ebp-2Ch],eax
00402190 mov eax,dword ptr [ebp-2Ch]
00402193 mov dword ptr [ebp-30h],eax
00402196 mov byte ptr [ebp-4],1
0040219A mov ecx,dword ptr [ebp-30h]
0040219D push ecx
0040219E lea ecx,[toby]
004021A1 call @ILT+155(boost::shared_ptr<dog>::operator=) (004010a0)
004021A6 mov byte ptr [ebp-4],0
004021AA lea ecx,[ebp-24h]
004021AD call @ILT+130(boost::shared_ptr<dog>::~shared_ptr<dog>) (00401087)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk