Author |
Topic |
|
znakeeye
Tomato Guru
379 Posts |
Posted - Jul 23 2008 : 06:17:52 AM
|
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
19024 Posts |
Posted - Jul 24 2008 : 12:45:25 PM
|
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 |
|
|
znakeeye
Tomato Guru
379 Posts |
Posted - Jul 28 2008 : 06:13:29 AM
|
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)) |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jul 28 2008 : 5:44:35 PM
|
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 |
|
|
znakeeye
Tomato Guru
379 Posts |
Posted - Jul 30 2008 : 06:39:07 AM
|
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! |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jul 30 2008 : 4:47:28 PM
|
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 |
|
|
znakeeye
Tomato Guru
379 Posts |
Posted - Jul 31 2008 : 04:03:39 AM
|
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!
|
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Jul 31 2008 : 3:56:20 PM
|
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 |
|
|
|
Topic |
|