Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 1532: Extract Method
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

khb
Tomato Guru

Germany
337 Posts

Posted - Aug 22 2006 :  06:04:19 AM  Show Profile  Reply with Quote
I applied "Extract Method" on:
  delete tICD.ptSock;
  tICD.ptSock = NULL;
where tICD is a struct. VA wants to create the following function:
  void MyMethod(t_IniterConData& &tICD)
Please notice the double ampersand.

Regards,
Marcus.



jpizzi
Tomato Guru

USA
642 Posts

Posted - Aug 23 2006 :  01:05:30 AM  Show Profile  Reply with Quote
I could get that behavior if I used the following code:

    t_IniterConData* whatever = new t_IniterConData();
    t_IniterConData& tICD = *whatever;

    delete tICD.ptSock;
    tICD.ptSock = NULL;

And then called Extract Method on the lines you said. But, since you cannot delete a reference, the code to extract makes no sense. Is it possible that your code is effectively the same, and that is why VA is messing up on it?

Note that I tried this in VS 2005 with VAX 1532. If you are using a different IDE or VAX version, let me know, and I will try it with that one.

Joe Pizzi
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Aug 23 2006 :  02:55:40 AM  Show Profile  Reply with Quote
case=2200
Go to Top of Page

khb
Tomato Guru

Germany
337 Posts

Posted - Aug 23 2006 :  04:28:21 AM  Show Profile  Reply with Quote
As I mentioned above, tICD (i.e., t_IniterConData) is a struct. It looks like this:
  struct t_IniterConData
  {
    MySocket* ptSock;
    ...
  }

  ...

  t_IniterConData tICD

  ...

  tICD.ptSock = new MySocket(...);

  ...

  delete tICD.ptSock;
  tICD.ptSock = NULL;
I think that this code is quite correct. At least it works for me.

I'm sorry, I always forget to mention that: I'm using VC6.

Regards,
Marcus.
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Aug 24 2006 :  12:03:00 AM  Show Profile  Reply with Quote
Wow. I must have been sleeping last night when I wrote that. I saw that you said that t_IniterConData was a struct. What I missed is that the delete operation is on the embedded pointer, not the struct itself. Duh...

At least Sean was awake, and entered a case for this.

Joe Pizzi
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Aug 24 2006 :  12:59:16 AM  Show Profile  Reply with Quote
...which will be fixed in 1533.
Go to Top of Page

khb
Tomato Guru

Germany
337 Posts

Posted - Aug 24 2006 :  02:15:30 AM  Show Profile  Reply with Quote
Great! Thank you!

Regards,
Marcus.
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Aug 27 2006 :  7:16:51 PM  Show Profile  Reply with Quote
Fixed in build 1533.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000