什么是程序中的0地址? [英] what is at 0 address in a program?

查看:247
本文介绍了什么是程序中的0地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,

在读取C和C ++文献时,我发现OS

为每个正在运行的程序分配了单独的受保护内存空间。

该程序不会进入另一个地址空间。

此外,为每个程序分配的地址空间完全相对。


现在我想知道堆栈从什么地址值开始

并且堆实际开始了?


什么是地址0(第一个地址)in一个程序?


换句话说,为什么程序中定义的变量的

地址为1,2,3 ......(当然,十六进制)?

地址值总是像0x00012ffc7并且喜欢..


问候,

Yogesh Joshi

Hello All,
While readling the C and C++ literature i came to know that the OS
allocates separate protected memory space for each running program and
the program do not interfare into one another''s address space.
Also the address space allocated for each program is totally relative.

Now i want to know that from what address value does the stack starts
and the heap actually start?

What is at address 0(first address) in a program?

In other words,why the variables defined in the program have their
address as 1,2,3...( of course in hexadecimal)?
The address values are always like 0x00012ffc7 and likes..

Regards,
Yogesh Joshi

推荐答案

文章< 11 ********************** @ z14g2000cwz .googlegroups .com>,

< yp ********* @ indiatimes.com>写道:
In article <11**********************@z14g2000cwz.googlegroups .com>,
<yp*********@indiatimes.com> wrote:
Hello All,
在读取C和C ++文献时,我发现操作系统为每个正在运行的程序分配了单独的受保护内存空间,并且
程序不会进入彼此的地址空间。
为每个程序分配的地址空间也是完全相对的。

现在我想知道堆栈的地址值是什么开始
堆真的开始了?
Hello All,
While readling the C and C++ literature i came to know that the OS
allocates separate protected memory space for each running program and
the program do not interfare into one another''s address space.
Also the address space allocated for each program is totally relative.

Now i want to know that from what address value does the stack starts
and the heap actually start?




Smashing the Stack为了好玩而且利润,是吗?



"Smashing the Stack" for fun & profit, are we?


* yp * ********@indiatimes.com
Hello All,
在阅读C和C ++文献的同时,我开始了解操作系统
为每个正在运行的程序分配单独的受保护内存空间,并且程序不会进入彼此的地址空间。
为每个程序分配的地址空间也是完全相对的。

现在我想知道堆栈启动的地址值是多少


这取决于几乎所有东西,包括月相。你

可以通过汇编语言获得该地址。或者你可以通过简单的东西获得一个非常接近它的地址




int main()

{

int a;

std :: cout<< & a<< std :: endl;

}


并且堆真的开始了吗?


不一定只有一个堆。


程序中地址0(第一个地址)的内容是什么?


通常这与指针值0相同,这意味着通常(在嵌入式系统编程中除了

),在现代计算机上,试图访问

该地址的内容将导致某种异常或陷阱。

换句话说,为什么程序中定义的变量的
地址为1 ,2,3 ......(当然是十六进制的)?
地址值总是像0x00012ffc7并且喜欢..
Hello All,
While readling the C and C++ literature i came to know that the OS
allocates separate protected memory space for each running program and
the program do not interfare into one another''s address space.
Also the address space allocated for each program is totally relative.

Now i want to know that from what address value does the stack starts
That depends on just about everything, including the phase of the moon. You
can obtain that address via assembly language. Or you can obtain an address
that is quite near to it by something as simple as

int main()
{
int a;
std::cout << &a << std::endl;
}

and the heap actually start?
There is not necessarily just one heap.

What is at address 0(first address) in a program?
Usually that is the same as pointer value 0, which means that usually (except
for embedded systems programming), on modern computers, trying to access the
contents of that address will result in some kind of exception or trap.
In other words,why the variables defined in the program have their
address as 1,2,3...( of course in hexadecimal)?
The address values are always like 0x00012ffc7 and likes..




你认为什么系统?你觉得好吗?


-

答:因为它弄乱了人们通常阅读文字的顺序。

问:为什么这么糟糕?

A:热门发布。

问:usenet和电子邮件中最烦人的是什么?



What system do you think you''re perceiving?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


yp ********* @ indiatimes。 com 写道:
Hello All,
在阅读C和C ++文献时,我来了o知道操作系统为每个正在运行的程序分配单独的受保护内存空间,并且程序不会进入彼此的地址空间。
此外,为每个程序分配的地址空间是完全相对的。


以上可能是真的,但它与C或C ++没有任何关系。

以上是有关OS设计的陈述,而不是语言。
现在我想知道堆栈启动的地址值是什么,堆真的开始了?


C或C ++都没有定义这个。

程序中的地址0(第一个地址)是什么?


C和C ++都没有定义它。

换句话说,为什么程序中定义的变量的地址为1,2 ,3 ...(当然是十六进制的)?
地址值总是像0x00012ffc7并且喜欢..

问候,
Yogesh Joshi
Hello All,
While readling the C and C++ literature i came to know that the OS
allocates separate protected memory space for each running program and
the program do not interfare into one another''s address space.
Also the address space allocated for each program is totally relative.
The above might be true, but it has nothing at all to do with C or C++.
The above are statements about OS design, not about languages.

Now i want to know that from what address value does the stack starts
and the heap actually start?
Neither C or C++ defines this.

What is at address 0(first address) in a program?
Neither C nor C++ define this either.

In other words,why the variables defined in the program have their
address as 1,2,3...( of course in hexadecimal)?
The address values are always like 0x00012ffc7 and likes..

Regards,
Yogesh Joshi



您没有询问有关您正在询问的编程语言的问题

有关OS设计和/或编译器设计的问题。语言没有定义

堆栈开始的位置或给定地址的位置。


john



You aren''t asking questions about programming languages you are asking
questions about OS design and/or compiler design. Languages don''t define
where the stack starts or what is at a given address.

john

这篇关于什么是程序中的0地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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