Author |
Topic |
|
kevinsikes
Tomato Guru
USA
271 Posts |
Posted - Jul 27 2004 : 1:08:13 PM
|
In the following example, hovering the cursor over bar correctly shows a tooltip with the "//bar function" comment. However, hovering over fn incorrectly shows "//bar function" as well.
void foo(); // foo function
void bar(); // bar function
void fn();
VAX for Visual C++ 6.0 VA_X.dll file version 10.0.1246.0 VAOpsWin.dll version 1.0.0.44 MSDev.exe version 6.0.9782.2 Devshl.dll version 6.0.9782.0 Devedit.pkg version 6.0.9782.0 Font: Courier -13(Pixels) Comctl32.dll version 5.82.2800.1106 WindowsNT 5.1 Build 2600 Service Pack 1 Single processor
Platform: Win32 (x86) Stable Includes: c:\\dxsdk\\include; c:\\sdkjul02\\include; C:\\Program Files\\Microsoft Visual Studio\\VC98\\INCLUDE; C:\\Program Files\\Microsoft Visual Studio\\VC98\\MFC\\INCLUDE; C:\\Program Files\\Microsoft Visual Studio\\VC98\\ATL\\INCLUDE; c:\\ntddk\\inc;
Library Includes: C:\\Program Files\\Microsoft Visual Studio\\VC98\\MFC\\SRC; C:\\Program Files\\Microsoft Visual Studio\\VC98\\MFC\\INCLUDE; C:\\Program Files\\Microsoft Visual Studio\\VC98\\ATL\\INCLUDE; C:\\Program Files\\Microsoft Visual Studio\\VC98\\CRT\\SRC;
Other Includes:
|
Kevin Sikes Infotainment Platform Design Engineer Ford Motor Company |
|
support
Whole Tomato Software
5566 Posts |
Posted - Jul 27 2004 : 6:45:29 PM
|
Maybe you should comment fn()?
Just kidding.
Obviously, people often write // comments on lines above definitions. VA X mistakenly assumes your // bar comment applies [also?] to fn()
case=178 |
|
|
Stephen
Tomato Guru
United Kingdom
781 Posts |
Posted - Jul 28 2004 : 04:01:47 AM
|
Do people ever write comments above definitions (or declarations) that don't take up a whole line, but start after some other code? |
Stephen Turner ClickTracks http://www.clicktracks.com/ Winner: ClickZ's Best Web Analytics Tool 2003 & 2004
|
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Jul 28 2004 : 06:16:55 AM
|
i think i have done that very occasionally inside C structures under UNIX, where the comment applies to more than one item. i cannot find any examples off hand, but it would be in cases like:
typedef struct {
int x_coord_start; // position of start point
int y_coord_start;
int x_coord_end; // position of end point
int y_coord_end;
} CONTRIVED_EXAMPLE;
realistically i would not expect VAX to handle this, since it will pick up far more false positives than real cases, at least in my code. |
zen is the art of being at one with the two'ness |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Jul 28 2004 : 11:23:01 AM
|
quote: Originally posted by support
Obviously, people often write // comments on lines above definitions...
We should clarify ourselves. People write comments on lines with definitions, but they rarely apply to lines that follow. The case feline makes is a clever exception. |
|
|
LarryLeonard
Tomato Guru
USA
1041 Posts |
Posted - Jul 29 2004 : 1:52:22 PM
|
Here's a slightly different case of this to test before you release a fix:
// O for a muse of fire that would ascend the
// very heaven of invention. A kingdom for a stage!
// Prices to act! And monarches to behold
// the swelling scene!
bool m_bWarlike;
public:
afx_msg void OnAssumeThePortOfMars();
The tooltip for OnAssumeThePortOfMars() has the comment, and should not. (Note the interspersion of a non-blank, non-commented line, "public:".)
|
|
|
Stephen
Tomato Guru
United Kingdom
781 Posts |
Posted - Jul 29 2004 : 3:06:13 PM
|
What if the comment was followed by two functions with no blank lines? Should they both have the comment, or just one of them? I sometimes comment a block of functions and sometimes comment an individual function in a block, but I suspect I do the latter more often. |
Stephen Turner ClickTracks http://www.clicktracks.com/ Winner: ClickZ's Best Web Analytics Tool 2003 & 2004
|
|
|
kevinsikes
Tomato Guru
USA
271 Posts |
Posted - Aug 02 2004 : 12:55:17 PM
|
Stephen, for your case, we could borrow a method from our friends in the publishing world:
int foo(); // First block of functions
int bar(); // Ibid
int beyond(); // Second block of functions
int all(); // Ibid
int recognition(); // Ibid
Now, tooltips for both foo() and bar() show "// First block of functions", while the remaining three functions have tooltip "// Second block of functions"
This is a rather contrived example with short comments, but for the case with l-o-o-o-n-g comments at the top of the block, this would allow a mechanism to duplicate comments to other functions in the block.
What thinks ye? |
Kevin Sikes Infotainment Platform Design Engineer Ford Motor Company |
|
|
Stephen
Tomato Guru
United Kingdom
781 Posts |
Posted - Aug 02 2004 : 1:22:27 PM
|
Nope. I want VA to do the right thing with my existing code style (which it does, in general). I never want to change my code style to accommodate it. |
Stephen Turner ClickTracks http://www.clicktracks.com/ Winner: ClickZ's Best Web Analytics Tool 2003 & 2004
|
Edited by - Stephen on Aug 02 2004 1:22:55 PM |
|
|
|
Topic |
|