From: RB on
> What I was getting at is the logical redundancy in:
> if (x == y) else if (x != y)
> It's similar to what MFC (still!) does in CWinThread::OnIdle:
> if (lCount <= 0) else if (lCount >= 0)
> Doug Harrison Visual C++ MVP
---------------------------------
Oh ok, yea I'm still a dummy of all sorts, not just logical redundancy
though that is one of my worst. Anyhow I got the cpy ctor in. I "think"
my program output looks better now. If you would please check it a
look at it at bottom. And thanks for the input.

ThroObj() : ObjVar(0xAAAAAAAA) // ctor //
{ cout << dec << "In ThroObj ctor\n"; }

ThroObj(const ThroObj& C_TObj) // cpy_ctor //
{
ObjVar = C_TObj.ObjVar;
cout << dec << "In ThroObj cpy_ctor\n";
}

~ThroObj() // dtor //
{ cout << dec << "In ThroObj dtor\n"; }

// program output
In 1st -try block- calling GlobalFunc)
In 2nd -try block- (in GlobalFunc) fixing to throw ThrowObj
In ThroObj ctor // +1 construction
In catch(...), and Win32 1st chance Kernel Exception code e06d7363
occured at addr 0x7C812AFB
fixing to re- throw ThroObj again
In ThroObj ctor // +2 construction
In ThroObj cpy_ctor // +3 construction of copy
In ThroObj dtor // -3 destruction (of copy ? )
In outer Catch(ThrowObj E)
Win32 1st chance Kernel Exception code e06d7363
occured at addr 0x7C812AFB
In ObjFunc
In ThroObj dtor // -2 destruction
In ThroObj dtor // -1 destruction

From: Doug Harrison [MVP] on
On Fri, 2 Jul 2010 15:18:42 -0400, "RB" <NoMail(a)NoSpam> wrote:

>Oh ok, yea I'm still a dummy of all sorts, not just logical redundancy
>though that is one of my worst. Anyhow I got the cpy ctor in. I "think"
>my program output looks better now. If you would please check it a
>look at it at bottom. And thanks for the input.
>
>ThroObj() : ObjVar(0xAAAAAAAA) // ctor //
> { cout << dec << "In ThroObj ctor\n"; }
>
> ThroObj(const ThroObj& C_TObj) // cpy_ctor //
> {
> ObjVar = C_TObj.ObjVar;
> cout << dec << "In ThroObj cpy_ctor\n";
> }
>
> ~ThroObj() // dtor //
> { cout << dec << "In ThroObj dtor\n"; }
>
>// program output
>In 1st -try block- calling GlobalFunc)
>In 2nd -try block- (in GlobalFunc) fixing to throw ThrowObj
>In ThroObj ctor // +1 construction
>In catch(...), and Win32 1st chance Kernel Exception code e06d7363
>occured at addr 0x7C812AFB
>fixing to re- throw ThroObj again
>In ThroObj ctor // +2 construction
>In ThroObj cpy_ctor // +3 construction of copy
>In ThroObj dtor // -3 destruction (of copy ? )
>In outer Catch(ThrowObj E)
>Win32 1st chance Kernel Exception code e06d7363
>occured at addr 0x7C812AFB
>In ObjFunc
>In ThroObj dtor // -2 destruction
>In ThroObj dtor // -1 destruction

It would be very helpful to print the addresses, e.g.

cout << this << " : Default ctor\n";

Do the complimentary thing in each of the instrumented functions. Then you
can match up the addresses of the constructed objects with the addresses of
the destructed objects.

--
Doug Harrison
Visual C++ MVP
First  |  Prev  | 
Pages: 1 2
Prev: Show More / Show Less Dialog
Next: Testing ....