int a [17]; int b = -1; / * a [17]与ANSI C中保证的b相同? * / [英] int a[17]; int b = -1; /* a[17] same as b guaranteed in ANSI C? */
问题描述
在代码中
int a [17];
int b = -1;
ANSI C保证b ;位于a [16]
之后的记忆中,以便a [17]是指b?
谢谢。
bq
In the code
int a[17];
int b = -1;
does ANSI C guarantee that "b" is located in memory right after "a[16]"
so that "a[17]" refers to "b"?
Thanks.
bq
推荐答案
文章< 6c ************************** @ posting.google.com>,
bq < FO ********** @ yahoo.com>写道:
In article <6c**************************@posting.google.com >,
bq <fo**********@yahoo.com> wrote:
在代码中
int a [17];
int b = -1;
ANSI C保证b位于a [16]之后的记忆中,以便a [17]是指b?
In the code
int a[17];
int b = -1;
does ANSI C guarantee that "b" is located in memory right after "a[16]"
so that "a[17]" refers to "b"?
我没有在C标准中看到过这个
类别的任何保证。>
另外,在最近的
版本的gcc上测试你的a和b的地址,结果证明b只是_before_ a在
内存地址空间。其他编译器可能表现不同。
-
Rouben Rostamian
I have not seen reference in the C standard to any guarrantee of this
sort.
Additionally, testing the addresses of your a and b on a recent
version of gcc, it turns out that b comes just _before_ a in the
memory address space. Other compilers may behave differently.
--
Rouben Rostamian
fo ********** @ yahoo.com (bq)写在
新闻:6c ************************** @ posting.google.c om:
fo**********@yahoo.com (bq) wrote in
news:6c**************************@posting.google.c om:
在代码中,
int a [17];
int b = -1;
ANSI C保证b为b。位于a [16]之后的记忆中,以便a [17]是指b?
In the code
int a[17];
int b = -1;
does ANSI C guarantee that "b" is located in memory right after "a[16]"
so that "a[17]" refers to "b"?
No.
-
- 马克 - >
-
No.
--
- Mark ->
--
2003年12月18日08:51:00 -0800, fo ********** @ yahoo.com (bq)写道:
On 18 Dec 2003 08:51:00 -0800, fo**********@yahoo.com (bq) wrote:
In代码
int a [17];
int b = -1;
ANSI C保证b位于a [16]之后的记忆中,以便a [17]是指b?
谢谢。
bq
In the code
int a[17];
int b = -1;
does ANSI C guarantee that "b" is located in memory right after "a[16]"
so that "a[17]" refers to "b"?
Thanks.
bq
号实际上,地狱,不! ;不要那样做。
-
Al Balmer
Balmer Consulting
再**************** ********@att.net
这篇关于int a [17]; int b = -1; / * a [17]与ANSI C中保证的b相同? * /的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!