Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1532: Extract Method

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
khb Posted - Aug 22 2006 : 06:04:19 AM
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.



7   L A T E S T    R E P L I E S    (Newest First)
support Posted - Aug 27 2006 : 7:16:51 PM
Fixed in build 1533.
khb Posted - Aug 24 2006 : 02:15:30 AM
Great! Thank you!

Regards,
Marcus.
support Posted - Aug 24 2006 : 12:59:16 AM
...which will be fixed in 1533.
jpizzi Posted - Aug 24 2006 : 12:03:00 AM
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.
khb Posted - Aug 23 2006 : 04:28:21 AM
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.
sean Posted - Aug 23 2006 : 02:55:40 AM
case=2200
jpizzi Posted - Aug 23 2006 : 01:05:30 AM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000