a.out的一些问题 [英] some problem of a.out

查看:79
本文介绍了a.out的一些问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是c编程的初学者。现在我有一个问题:

[code]

main(){

int i = 3;

int j;

}

将它编译成a.out.

其中''我',''j''在a.out,bss部分,日期部分,或者在
堆栈中?

想想你!

解决方案

Kies Lee说:

我是c编程的初学者。现在我有一个问题:
[code]
main(){
int i = 3;
int j;
}
将它编译成一个.out。
'i',''j'在a.out,bss部分,日期部分或堆栈中?


编译器无需在

all处创建任何对象,因为不这样做不会改变程序的输出。


无论如何,你问题的答案完全取决于

的实现。 C编译器不需要使用bss部分,

日期部分,数据部分或堆栈。

想你!




你很喜欢。


-

Richard Heathfield

" Usenet is一个奇怪的地方 - dmr 29/7/1999

http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)


>编译器无需在

all处的任何位置创建对象,因为不这样做不会改变程序的输出。




,但最有可能的是他的代码将优化为空的main()返回

0

所以我或者j无处存在。此外,a.out有自己的文件格式,

决定事物将被卸载的位置。在执行期间在内存中。

如果您在dos上编译为.EXE文件,那么您的操作系统和文件
常量/变量所在的位置将由您的操作系统和文件决定

格式。


一般来说,如果你像你一样声明和定义你的变量,它们会在堆栈(或自动商店)中存在
),具有不同的含义

取决于您的编译器和操作系统等。


因此您的问题在于装配的边界和某些东西

else (其中else绝对不是标准的C !!!)所以一个程序集

新闻组将更适合给你如何工作的指示。


Richard Heathfield写道:

Kies Lee说:


想想你!



你很喜欢。




不,那是他告诉你把你的脑子里装着,想想,你!

他留下了一个逗号。


Brian


-

如果电视是保姆,互联网是一个醉酒的图书馆员,他们不会闭嘴。

- Dorothy Gambrell( http://catandgirl.com

I am a beginner in c programming. Now I have a question:
[code]
main() {
int i = 3;
int j;
}
Compile it to a.out.
Where the ''i'',''j'' be in the a.out, the bss section, date section, or in
the stack?
Think you!

解决方案

Kies Lee said:

I am a beginner in c programming. Now I have a question:
[code]
main() {
int i = 3;
int j;
}
Compile it to a.out.
Where the ''i'',''j'' be in the a.out, the bss section, date section, or in
the stack?
There''s no requirement for the compiler to create the objects anywhere at
all, because not doing so will not change the output of the program.

In any case, the answer to your question depends entirely on the
implementation. C compilers are not required to employ a bss section, a
date section, a data section, or a stack.
Think you!



You''re wilcome.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


> There''s no requirement for the compiler to create the objects anywhere at

all, because not doing so will not change the output of the program.



but most likely his code will be optimized to an empty main() returning
0
So i, or j exist nowhere. Besides, a.out has its own file format which
determines where things will be "unloaded" in memory during execution.
If you compiled to a .EXE file on dos, the places where your
constants/variables reside will be determined by your OS and your file
format.

Generally if you declare and define your variables like you did, they
reside on the stack (or auto store), which has different meaning
depending on your compiler and OS etc.

Therefore your question lies on the border of assembly and something
"else" (where "else" is definitely not standard C!!!) so an assembly
newsgroup will be better suited to give you pointers on how this works.


Richard Heathfield wrote:

Kies Lee said:


Think you!



You''re wilcome.



No, that was him telling you to put your brain in gear, "Think, you!"
He left out a comma.

Brian

--
If televison''s a babysitter, the Internet is a drunk librarian who
won''t shut up.
-- Dorothy Gambrell (http://catandgirl.com)


这篇关于a.out的一些问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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