Unix中指针的格式 [英] Format of Pointers in Unix

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

问题描述

你好,


在x86机器上,C中指针的格式是什么?我知道一个事实是x86 p模式使用/ selector:offset / notation,其中

选择器在GDT或LDT中定义。是否会将指针延伸到

,或者Unix是否使用平面内存模型?


-

Daniel Rudy


删除nospam,无效和0123456789回复。

Hello,

On a x86 machine, what is the format of a pointer in C? I know for a
fact that the x86 p-mode uses a /selector:offset/ notation where the
selector is defined in either the GDT or LDT. Does that carry over into
the pointer, or does Unix use the flat memory model?

--
Daniel Rudy

Remove nospam, invalid, and 0123456789 to reply.

推荐答案

在''comp.lang.c中'',Daniel Rudy< dc **** @ invalid.pacbell.nospam.net.0123456789>

写道:
In ''comp.lang.c'', Daniel Rudy <dc****@invalid.pacbell.nospam.net.0123456789>
wrote:
在x86机器上, C中指针的格式是什么?
On a x86 machine, what is the format of a pointer in C?




< CLC>

C语言没有定义格式一个指针答案是

平台依赖。阅读你的编译手册。

< / CLC>


-

-ed-在这里收到我的电子邮件: http://marreduspam.com/ad672570

C语言常见问题: http://www.eskimo.com/~scs /C-faq/top.html

C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99

FAQ de fclc: http://www.isty-info.uvsq.fr/~rumeau/fclc/



<CLC>
The C language doesn''t define "the format of a pointer". The answer is
plateform dependent. Read your compiler manual.
</CLC>

--
-ed- get my email here: http://marreduspam.com/ad672570
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/


文章< Xn ************************** *@212.27.42.72>,

Emmanuel Delahaye< em ********** @ noos.fr>写道:
In article <Xn***************************@212.27.42.72>,
Emmanuel Delahaye <em**********@noos.fr> wrote:
在''comp.lang.c''中,Daniel Rudy< dc **** @ invalid.pacbell.nospam.net.0123456789>
写道:
In ''comp.lang.c'', Daniel Rudy <dc****@invalid.pacbell.nospam.net.0123456789>
wrote:
在x86机器上,C中指针的格式是什么?
On a x86 machine, what is the format of a pointer in C?



< CLC>
C语言没有定义指针的格式。答案是取决于平台形式。阅读您的编译器手册。
< / CLC>



<CLC>
The C language doesn''t define "the format of a pointer". The answer is
plateform dependent. Read your compiler manual.
</CLC>




他说在x86上并提到Unix在主题行中,所以他似乎认为它是平台依赖的。


它可能不在编译器手册中 - 指针格式(以及其他数据类型)通常由操作系统的ABI决定。

否则,您将无法使用已编译的应用程序与系统的库不同的编译器。


但是,由于x86平台上有多个Unix供应商,

并且它们不需要彼此二进制兼容,

答案可能特定于Unix的特定版本OP是

使用。由于他没有说,我们甚至无法在comp.unix.programmer中给出这个

的答案。


- < br $> b
Barry Margolin, baS@alum.mit.edu

阿灵顿,MA

***请在新闻组中发布问题,而不是直接发给我***



He said "on a x86" and mentioned "Unix" in the Subject line, so he seems
to realize it''s platform dependent.

It''s probably not in the compiler manual -- the format of pointers (and
other data types) is typically dictated by the operating system''s ABI.
Otherwise, you wouldn''t be able to use applications compiled with a
different compiler than the system''s libraries.

However, since there''s more than one vendor of Unix for x86 platforms,
and they''re not required to be binary-compatible with each other, the
answer may be specific to the particular version of Unix the OP is
using. Since he didn''t say, we can''t even give a good answer for this
in comp.unix.programmer.

--
Barry Margolin, ba****@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


并且在某个时间2004年4月16日07:34,世界停止了,并且随着Barry Margolin为人类贡献了以下内容,b / b

And somewhere around the time of 05/16/2004 07:34, the world stopped and
listened as Barry Margolin contributed the following to humanity:
文章< Xn * **************************@212.27.42.72> ;,
Emmanuel Delahaye< em ******** **@noos.fr>写道:

In article <Xn***************************@212.27.42.72>,
Emmanuel Delahaye <em**********@noos.fr> wrote:

在''comp.lang.c'',Daniel Rudy< dc **** @ invalid.pacbell.nospam.net.0123456789>
写道:

In ''comp.lang.c'', Daniel Rudy <dc****@invalid.pacbell.nospam.net.0123456789>
wrote:

在x86机器上,C中指针的格式是什么?
< CLC>
C语言没有定义指针的格式。答案是取决于平台形式。阅读你的编译器手册。
< / CLC>
On a x86 machine, what is the format of a pointer in C?
<CLC>
The C language doesn''t define "the format of a pointer". The answer is
plateform dependent. Read your compiler manual.
</CLC>




Emmanuel,回到90年代初的时候,我正在编程在DOS下使用Pascal和Assembler使用DOS扩展程序使用
。在386P模式中,

指针格式是16位选择器,对于48位
指针,具有32位偏移。在286P模式下,选择器和偏移都是16位。

选择器是全局描述符表或

本地描述符表的索引。这由x86硬件表示。我没有

想知道启用了PAX的X86机器上的格式是什么。


此外,I * DID *在cc和编译器手册中查找它没有说。

这就是为什么我首先要问的原因。此外,Unix是否使用

分段或平面内存模型。我问,因为我不知道,我系统上的

文档不管怎样都不能直接回答。

他说在x86上并提到Unix在主题行中,所以他似乎意识到它是依赖于平台的。

它可能不在编译器手册中 - 指针的格式(和
其他数据类型)通常由操作系统的ABI决定。
否则,您将无法使用使用与系统库不同的编译器编译的应用程序。

但是,由于x86平台上有多个Unix供应商,
并且它们不需要彼此二进制兼容,
答案可能特定于OP使用的特定Unix版本。由于他没有说,我们甚至不能在comp.unix.programmer中给出一个好的答案。



Emmanuel, way back when in the early 90''s, I was programming under DOS
using Pascal and Assembler using a DOS extender. In the 386P-Mode, the
pointer format is 16 bit selector with a 32 bit offset for a 48 bit
pointer. In 286P-Mode, both selector and offset is 16 bit. The
selectors are indices into either the Global Discriptor Table or the
Local Descriptor Table. This is denoted by the x86 hardware. I have NO
idea what the format is on a X86 machine with PAX enabled.

Besides, I *DID* look in the compiler manual for cc and it doesn''t say.
Which is why I''m asking in the first place. Also, does Unix use the
segmented or flat memory model. I''m asking because I don''t know and the
docs on my system don''t really give a straight answer either way.

He said "on a x86" and mentioned "Unix" in the Subject line, so he seems
to realize it''s platform dependent.

It''s probably not in the compiler manual -- the format of pointers (and
other data types) is typically dictated by the operating system''s ABI.
Otherwise, you wouldn''t be able to use applications compiled with a
different compiler than the system''s libraries.

However, since there''s more than one vendor of Unix for x86 platforms,
and they''re not required to be binary-compatible with each other, the
answer may be specific to the particular version of Unix the OP is
using. Since he didn''t say, we can''t even give a good answer for this
in comp.unix.programmer.




啊,忘了关于那个,我的坏:-)我正在使用FreeBSD 4.9-RELEASE。


-

Daniel Rudy


删除nospam,无效和0123456789回复。



Ah, forgot about that, my bad :-) I''m using FreeBSD 4.9-RELEASE.

--
Daniel Rudy

Remove nospam, invalid, and 0123456789 to reply.


这篇关于Unix中指针的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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