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
 Surround selection on * bug
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

vortex
New Member

Ukraine
6 Posts

Posted - Apr 07 2006 :  04:18:50 AM  Show Profile  Reply with Quote
VA 1444, MSVS 2005

Surrounding code with coments by pressing '*', when option "Surround selection on /*( { and #" is on, corrupts existing C-style (/* */) comments in surrounding code.

Example.
Before selecting and pressing '*':


After:


You see. In comments, which encloses 'a' parameter, we have redundant space symbol between '/' and '*'.
If I press '*' one more time, this comments will be fixed, but often I remove VA autocomments by hand, and have corrupted my own code.

rhummer
Tomato Guru

USA
527 Posts

Posted - Apr 07 2006 :  10:20:03 AM  Show Profile  Reply with Quote
case=541

It's on the list to fix ;)

Tools Engineer - Raven Software
VS2005 SP2/VS2008 SP1 - VAX <LATEST> - Win 7 x64

Go to Top of Page

ether
Tomato Guru

USA
130 Posts

Posted - Apr 07 2006 :  12:22:28 PM  Show Profile  Reply with Quote
The only problem with leaving your embedded comment alone is that the code will not compile.

//This will not compile because the */ after a will close the comment block!
/*
void Foo(int /* a */)
*/


This really shouldn't be a case, as I believe it is working the way it should be.
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Apr 07 2006 :  12:22:33 PM  Show Profile  Reply with Quote
That behavior is by design since nested C-style comments are usually illegal. Does the following compile in vs2005 (it doesn't in vs2003)?

/*
void Foo(int /* a */)
*/
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Apr 07 2006 :  6:31:23 PM  Show Profile  Reply with Quote
*checks*
no, this does not compile in VS2005. it is coloured correctly, the comment ends before the close bracket, and the compiler picks up the unexpected close bracket.

zen is the art of being at one with the two'ness
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Apr 07 2006 :  11:44:11 PM  Show Profile  Reply with Quote
quote:
That behavior is by design since nested C-style comments are usually illegal
And, amazingly enough, when you remove the outside comments (using the *, again), the "messed up" comment markers are restored!

I wonder how complex we can get with the nesting of comments before something messes up?

Joe Pizzi
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Apr 08 2006 :  5:00:38 PM  Show Profile  Reply with Quote
vortex i understand the problem, especially when you remove the /* */ comments by hand, i do this myself now and then.

this is why some programming books suggest that you use the // comment style as much as possible, since it does not have this problem.

can you try moving to using / on selected blocks instead of * ? this is the same single key press for you, but stops the problem happening.

zen is the art of being at one with the two'ness
Go to Top of Page

vortex
New Member

Ukraine
6 Posts

Posted - Apr 12 2006 :  05:36:49 AM  Show Profile  Reply with Quote
ether
About compilation failure of:
/*
void Foo(int /* a */)
*/
sorry, I don't draw attention to this.

feline
Actually I don't use C-style comments, but problem comes from VAX ability to comment out the default values of function parameters in function definition (in .cpp files, for example) declared elsewere.
For example we have following code:

--- my.h ---
void A(int b = 10);
--- end of my.h ---

--- my.cpp ---
void A(int b /* = 0 */)
{
}
--- end of my.cpp ---

I do not write all code in the parenthesis in .cpp file. I type "void A(" and press ctrl-enter. VA pastes needed code by itself.

And I discovered another bug concerned with comments (now C++ style: //). At the end of the source file, commenting block with "/" button won't work.
Example:

void Foo(int a)
{
std::cout << a << std::end;
} // <- Note: no newline here

If I select block of code including last line, and press "/" nothing happens. After placing newline after end of the function, in our example, commenting shortcut works as expected.
Go to Top of Page

jpizzi
Tomato Guru

USA
642 Posts

Posted - Apr 12 2006 :  5:45:21 PM  Show Profile  Reply with Quote
The commenting out a block of text including the last line in the file has been mentioned before. It is a bug: case=414.

However, since a file that does not end in a new line is ill-formed according to the Standard, I suggest that you do everything you can to eliminate those cases. I have even seen cases where such a thing would cause compilation failures.

Joe Pizzi
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Apr 15 2006 :  4:48:07 PM  Show Profile  Reply with Quote
some of my code has to compile under both Windows and UNIX. Windows is quite happy with no blank line at the bottom of the file, but the UNIX compiler will always flag this.

zen is the art of being at one with the two'ness
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