数组在内存中是连续的吗? [英] are arrays contiguous in memory?

查看:333
本文介绍了数组在内存中是连续的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在调试期间查看了''数组<>''中的地址,发现

地址是连续的。这是保证,还是只有

它可以做什么?


[== P ==]


PS = VS C ++ .NET 2005 Express使用clr:/纯语法

I looked at the addresses in an ''array<>'' during debug and noticed that the
addresses were contiguous. Is this guaranteed, or just something it does if
it can?

[==P==]

PS = VS C++.NET 2005 Express using clr:/pure syntax

推荐答案

我想如果你锁定数组,数组将是连续使用

指针因为它是唯一可以通过

指针访问数组的安全方式:-)

Peteroid ; < PE ************ @ msn.com>一个écritdansle message de

新闻:%2 *************** @ TK2MSFTNGP12.phx.gbl ...
I guess that if you lock the array, the array will be contiguous to use a
pointer as it is the only safe way you can access the array through a
pointer :-)
"Peteroid" <pe************@msn.com> a écrit dans le message de
news:%2***************@TK2MSFTNGP12.phx.gbl...
我在调试期间查看了''数组<>''中的地址,注意到
地址是连续的。这是保证,还是只做它b $ b如果可以的话?

[== P ==]

PS = VS C ++ .NET 2005 Express使用clr :/纯语法
I looked at the addresses in an ''array<>'' during debug and noticed that the addresses were contiguous. Is this guaranteed, or just something it does if it can?

[==P==]

PS = VS C++.NET 2005 Express using clr:/pure syntax



Peteroid写道:
Peteroid wrote:
我查看了''数组中的地址<> ;''在调试期间注意到地址是连续的。这是保证,还是只是它可以做的事情?
I looked at the addresses in an ''array<>'' during debug and noticed
that the addresses were contiguous. Is this guaranteed, or just
something it does if it can?




托管数组总是连续的,但你只能观察/采取
通过将指针指针插入数组,
有利于这一事实。

当然,如果它是一个引用类型的数组,那么连续的数组

将仅包含指向所包含对象的指针,这很可能不会是连续的。


-cd



Managed arrays are always contiguous, but you can only observe/take
advantange of that fact by getting a pinning pointer into the array.
Naturally, if it''s an array of reference type, then the contiguous array
will contain only pointers to the contained objects, which in all likelihood
will not be contiguous.

-cd




" Peteroid" < PE ************ @ msn.com>在留言中写道

新闻:%2 *************** @ TK2MSFTNGP12.phx.gbl ...

"Peteroid" <pe************@msn.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
我看了看调试期间''数组<>''中的地址,注意到
地址是连续的。这是保证,还是只有它可以做的事情?

[== P ==]

PS = VS C ++ .NET 2005 Express使用clr :/纯语法
I looked at the addresses in an ''array<>'' during debug and noticed that the
addresses were contiguous. Is this guaranteed, or just something it does if
it can?

[==P==]

PS = VS C++.NET 2005 Express using clr:/pure syntax




是的。


Willy。



Yes.

Willy.


这篇关于数组在内存中是连续的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆