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
 Feature Requests
 Annoying extra parenthesis
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

znakeeye
Tomato Guru

379 Posts

Posted - Jul 23 2008 :  06:17:52 AM  Show Profile  Reply with Quote
I have this:
sprintf(buf, "%d", myInt);

And want to change it into this:
sprintf_s(buf, _countof(buf), "%d", myInt);

When I have typed "_countof(buf)" I get "_countof(buf))"

Very annoying!

feline
Whole Tomato Software

United Kingdom
18946 Posts

Posted - Jul 24 2008 :  12:45:25 PM  Show Profile  Reply with Quote
Which IDE and version of VA are you using?

If you delete the "_countof(buf)" and retype it do you see the same problem?

So far I cannot reproduce this problem.

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

znakeeye
Tomato Guru

379 Posts

Posted - Jul 28 2008 :  06:13:29 AM  Show Profile  Reply with Quote
Tried it in VAX 1646. VS 2008.

I can reproduce it like so:

I believe Ctrl+V (I copied 'buf') is what's causing it!
_cou<enter><ctrl+v>) --> _countof(buf))
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jul 28 2008 :  5:44:35 PM  Show Profile  Reply with Quote
Most strange: when I type _cou<enter> then I get
_countof|

instead of
_countof(|)

where | is the caret. Do you see the second one? Can you reproduce this in a new default test project?

Edited by - accord on Jul 28 2008 5:49:25 PM
Go to Top of Page

znakeeye
Tomato Guru

379 Posts

Posted - Jul 30 2008 :  06:39:07 AM  Show Profile  Reply with Quote
Sorry, my mistake. The exact way to reproduce this is (VAX 1646, VS 2008):

int myInt;
char buf[100];
sprintf_s(buf, | "%d", myInt);

Now copy 'buf' to the Clipboard and then type:
_cou<enter>(<ctrl+v>)

You get:
1: _countof(|) <--- enter-completion
2: _countof(buf) <--- pasting 'buf'
3: _countof(buf)) <--- typing ')'

Hope that helps!
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jul 30 2008 :  4:47:28 PM  Show Profile  Reply with Quote
What is _countof in your source? For me this is a define.
#define _countof(_Array) sizeof(*__countof_helper(_Array))

This is code from the definition field.
So when I type _cou<enter> I get
_countof|

This is because parenthesis appears for functions, but not for defines.

If you type
#define SOMEDEF

void Test()
{
    SOMED<enter>
}

You should get SOMEDEF| without parenthesis. Can you please try this out?

Edited by - accord on Jul 30 2008 5:00:59 PM
Go to Top of Page

znakeeye
Tomato Guru

379 Posts

Posted - Jul 31 2008 :  04:03:39 AM  Show Profile  Reply with Quote
I keep expressing myself as a monkey. Sorry :P

The parenthesis appears when I explicitly type '('. Hence, the <enter> key is not the problem!

"buf" is in Clipboard

_cou<enter>    --> _countof
(              --> _countof(|)
<ctrl+v>       --> _countof(buf)
)              --> _countof(buf))

NOTE: This seems to only happen when inside another function:
sprintf(buf, | "%d", myInt); // Do the above at the cursor!
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jul 31 2008 :  3:56:20 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the detailed report

case=18859

Edited by - accord on Jul 31 2008 3:56:36 PM
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