NULL指针内部表示。 [英] NULL pointer internal representation.

查看:99
本文介绍了NULL指针内部表示。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我读到指针表示可以非零位模式,机器

specific.Compiler当值为'0'时在指针上下文中,

将其转换为机器特定的空指针位模式。


我的问题是程序是否引用了特定值

机器用来引用空指针,编译器如何对待

那个?。


谢谢,

-Khan

Hi,

I read that pointer representation can non-zero bit pattern, machine
specific.Compiler when comes accross value ''0'' in pointer context,
converts it to machine specific null pointer bit-pattern.

My question is if a program refers to that specific value which is
used by the machine to refer to null pointer, how compiler treats
that?.

Thanks,
-Khan

推荐答案

khan写道:
khan wrote:

我读过指针表示可以非零位模式,机器

specific.Compiler在指针上下文中有值''0'时,

将它转换为机器特定的空指针位模式。
I read that pointer representation can non-zero bit pattern, machine
specific.Compiler when comes accross value ''0'' in pointer context,
converts it to machine specific null pointer bit-pattern.



是的:空指针的内部表示是

C实现发现方便的,编译器替换了

null指针常量(指针上下文中的文字零值),

方便的值。

Yes: the internal representation of the null pointer is whatever the
C implementation finds convenient, with the compiler replacing the
null pointer constant (a literal zero value in pointer context) with
its convenient value.


我的问题是程序指的是机器用来引用空指针的那个特定值,这是编译器如何处理

那个?
My question is if a program refers to that specific value which is
used by the machine to refer to null pointer, how compiler treats
that?



(fx:rhetorical)如果

保持在标准范围内,该计划将如何实现这一目标?

[不可能,所以编译器不需要对它做任何事情。]


-

"生活充满了神秘感。考虑其中一个。 Sinclair,/ Babylon 5 /

Hewlett-Packard Limited注册办事处:Cain Road,Bracknell,

注册号:690597 England Berks RG12 1HN

(fx:rhetorical) How would the program manage to do that while
staying inside the Standard?

[It can''t, so the compiler doesn''t need to do anything about it.]

--
"Life is full of mysteries. Consider this one of them." Sinclair, /Babylon 5/

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN


4月27日下午3:59,Chris Dollin< chris.dol ... @ hp.comwrote:
On Apr 27, 3:59 pm, Chris Dollin <chris.dol...@hp.comwrote:

khan写道:
khan wrote:

我读到指针表示可以非零位模式,机器

specific.Compiler什么时候来指针上下文中的值0,

将其转换为机器特定的空指针位模式。
I read that pointer representation can non-zero bit pattern, machine
specific.Compiler when comes accross value ''0'' in pointer context,
converts it to machine specific null pointer bit-pattern.



是的:空指针的内部表示是

C实现发现方便的,编译器替换了

null指针常量(指针上下文中的文字零值),

方便的值。


Yes: the internal representation of the null pointer is whatever the
C implementation finds convenient, with the compiler replacing the
null pointer constant (a literal zero value in pointer context) with
its convenient value.


我的问题是程序指的是机器用来引用空指针的那个特定值,这是编译器如何处理

那个?
My question is if a program refers to that specific value which is
used by the machine to refer to null pointer, how compiler treats
that?



(fx:rhetorical)如果

留在标准内,该计划将如何实现这一目标?

[不可能,所以编译器不需要对它做任何事情。]


-

"生活充满了神秘感。考虑其中一个。 Sinclair,/ Babylon 5 /

Hewlett-Packard Limited注册办事处:Cain Road,Bracknell,

注册号:690597 England Berks RG12 1HN


(fx:rhetorical) How would the program manage to do that while
staying inside the Standard?

[It can''t, so the compiler doesn''t need to do anything about it.]

--
"Life is full of mysteries. Consider this one of them." Sinclair, /Babylon 5/

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN




我想确认一下我对这些的理解:


一个教程将表示空指针指向某些

特定值,它不在处理器的地址空间中,并且

哪个处理器视为无指针的空指针。


谢谢,

-Mushtaq



I want to confirm my understanding on these:

A proessor will have the representation of null pointer to some
specific value, which is not in the address space of the processor and
which processor treats as a null pointer that points nowhere.

Thanks,
-Mushtaq


khan< mu ********* @ gmail.comwrote:
khan <mu*********@gmail.comwrote:

4月27日下午3:59,Chris Dollin< chris.dol ... @ hp.comwrote:
On Apr 27, 3:59 pm, Chris Dollin <chris.dol...@hp.comwrote:

khan写道:
khan wrote:

我读到指针表示可以非零位模式,机器

specific.Compiler when来自va lue''0''在指针上下文中,

将其转换为机器特定的空指针位模式。
I read that pointer representation can non-zero bit pattern, machine
specific.Compiler when comes accross value ''0'' in pointer context,
converts it to machine specific null pointer bit-pattern.



是的:空指针的内部表示是

C实现发现方便的,编译器替换了

null指针常量(指针上下文中的文字零值),

方便的值。

Yes: the internal representation of the null pointer is whatever the
C implementation finds convenient, with the compiler replacing the
null pointer constant (a literal zero value in pointer context) with
its convenient value.


我的问题是程序指的是机器用来引用空指针的那个特定值,这是编译器如何处理

那个?
My question is if a program refers to that specific value which is
used by the machine to refer to null pointer, how compiler treats
that?



(fx:rhetorical)如果

保持在标准范围内,该计划将如何实现这一目标?

[不可能,所以编译器不需要对它做任何事情。]

(fx:rhetorical) How would the program manage to do that while
staying inside the Standard?

[It can''t, so the compiler doesn''t need to do anything about it.]


我想确认一下我对这些的理解:


一个过程会有一个空指针表示某些

特定值,
I want to confirm my understanding on these:

A proessor will have the representation of null pointer to some
specific value,



是;

Yes;


不在处理器的地址空间中且
which is not in the address space of the processor and



不,但实际上与其他点无关(虽然我不知道

任何处理器如何引用不在其自己地址的指针

空间);

no, but actually not relevant to the other points (although I wonder how
any processor could refer to a pointer which is not in its own address
space);


哪个处理器将其视为无指针的空指针。
which processor treats as a null pointer that points nowhere.



和是。


Richard

and yes.

Richard


这篇关于NULL指针内部表示。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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