开发者

Visual studio printing range within array

开发者 https://www.devze.com 2023-01-22 07:08 出处:网络
Blob is defined as follows: unsigned char* blob=new unsigned char[64]; We then try using the immediate window

Blob is defined as follows:

unsigned char* blob=new unsigned char[64];

We then try using the immediate window

blob+12
0开发者_StackOverflow中文版x084F8854
    *blob+12: 0x75 'u'
blob+13
0x084F8855
    *blob+13: 0x11 ''
blob+14
0x084F8856
    *blob+14: 0x94 ''
blob+12,3
0x084F8854
    [0]: 0x75 'u'
    [1]: 0x0 ''
    [2]: 0x0 ''

Why doesn't blob+12,3 display the 3 values for blob 12? What is it doing instead?


More generally, "blob,20" works, but "blob+0,20" does not.

My best guess is it's a bug of managed expressions evaluator. If you look in MSDN, they go in length about how these things don't work and those things don't work. It could be that, in the twisted mind of the evaluator, blob+12 constitutes a 1-element array of type char, therefore elements beyond the first can't be displayed.


The language is C++. He has defined an unsigned char array and watching the variable values using the immediate window. The array name is blob. I tried on VS2008, I verified with a char pointer. when you say blob+12,3.., it is converted to (blob+12)[0],(blob+12)[1],(blob+12)[2]..which is essentially same as blob+13,blob+14 and blob+15 and soon.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号