阵列内的 Visual Studio 打印范围
Blob 定义如下:
unsigned char* blob=new unsigned char[64];
然后我们尝试使用立即窗口
blob+12
0x084F8854
*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 ''
为什么 blob+12,3 不显示 blob 12 的 3 个值?它在做什么?
Blob is defined as follows:
unsigned char* blob=new unsigned char[64];
We then try using the immediate window
blob+12
0x084F8854
*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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
语言是C++。他定义了一个无符号字符数组并使用立即窗口观察变量值。数组名称是 blob。我在VS2008上尝试过,我用char指针进行了验证。当你说 blob+12,3.. 时,它会转换为 (blob+12)[0],(blob+12)[1],(blob+12)[2].. 本质上与 blob+ 相同13、blob+14 和 blob+15 等等。
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.
更一般地说,“blob,20”有效,但“blob+0,20”则无效。
我最好的猜测是这是托管表达式评估器的错误。如果你查看 MSDN,他们会详细介绍这些东西如何不起作用以及那些东西如何不起作用。可能是,在评估者扭曲的头脑中,blob+12 构成了 char 类型的单元素数组,因此无法显示第一个元素之外的元素。
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.