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
 /* */ Breaks existing /* */
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

rblondeau
Tomato Guru

Canada
102 Posts

Posted - Jun 23 2004 :  5:09:05 PM  Show Profile
I have just noticed that commenting a section of code by doing a surround selection * not only surrounds the highlighted text with /* */, but it also disrupts existing /* */ comments. It puts a space between the / and * effectively negating the comment. This is a problem because when you uncomment the same block, the spaces that it added between / and * (or * and /) are not removed.

This caused me a fair amount of grief today when I had commented out (and then later uncommented) a fairly large section of code that had many /* */ blocks in it. I had to spend time going back through my code to remove the spaces that had been added just so that the compiler would no longer think that it needed to compile those lines.

Is there any way for VAX to remember where it added those spaces, and then remove them when the block is uncommented? I don't figure that would be possible so I suggest an alternative: if the block of code being commented out with a * has any /* */ comment blocks within it, then simply switch the comment to // for each line in the block instead of /* */ around the entire block. This is as easy to uncomment as /* */ and prevents the undesirable effect of the extra spaces in the comment characters.

Uniwares
Tomato Guru

Portugal
2321 Posts

Posted - Jun 23 2004 :  7:07:35 PM  Show Profile
it actually HAS to do this to make it work. otherwise the first */ would end the inserted /* and you would have a bigger mess.
A possible solution would be to insert a special char between * and / (like -? or %).
Go to Top of Page

rblondeau
Tomato Guru

Canada
102 Posts

Posted - Jun 23 2004 :  7:10:41 PM  Show Profile
I realize that, and that's why I suggested the alternate commenting style of // for the highlighed block when there are existing /* */ blocks within the highlighted block.
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jun 23 2004 :  10:03:34 PM  Show Profile
Interesting idea.

case=144

For now, surround with /

Whole Tomato Software, Inc.
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jul 12 2004 :  1:39:07 PM  Show Profile
Not to stir up the topic, but VA X inserts a space between /* when surrounding with * to comment. VA X removes the space when uncommenting, assuming you uncomment the entire selection you commented.

Pressing * when this line is selected:
int x = 0; /* someComment */

Yields this:
/*
int x = 0; / * someComment * /
*/

Pressing * again, ie when all three lines are selected, returns the code to its original state.

This said, we prefer commenting with /

Whole Tomato Software, Inc.
Go to Top of Page

rblondeau
Tomato Guru

Canada
102 Posts

Posted - Jul 12 2004 :  3:34:07 PM  Show Profile
I just tried it again, and lo and behold, it doesn't forget to remove the spaces anymore. I know it used to because I had to manually remove them before. Oh well, at least now it works. Thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000