int main(void){return main(); }
在对象行中这是一个符合规定的程序吗?
如果是这样,为什么?
如果没有,为什么?
我'' d期望它很像
int main(无效)
{
for(;;);
}
但是如果我用lcc-win32编译它并在其rundos.exe中运行它,它表示
程序退出时的返回值为-1073741819(即-2 ^ 30 + 5)之后
0.032秒左右。为什么?
-
#include< stdio.h>
#include< stdlib.h>
int main(void)/ *不要在家里尝试这个* / {
const size_t dim = 256; int i;
for(i = 0; malloc(dim); i ++)/ * nothing * /;
printf("你已经完成了!%zu \ n",i * dim);
puts(" \ n\\\
- Army1987");返回0;
}
Is that in the object line a conforming program?
If so, why?
If not, why?
I''d expect it to be much like
int main(void)
{
for (;;);
}
But if I compile it with lcc-win32 and run it in its rundos.exe, it says the
program exits with a return value of -1073741819 (i.e. -2^30 + 5) after
0.032 seconds or so. Why?
--
#include <stdio.h>
#include <stdlib.h>
int main(void) /* Don''t try this at home */ {
const size_t dim = 256; int i;
for (i=0; malloc(dim); i++) /*nothing*/ ;
printf("You''re done! %zu\n", i*dim);
puts("\n\n--Army1987"); return 0;
}
Army1987写于03/29/07 14:31,:
Army1987 wrote On 03/29/07 14:31,:
对象行中的符合程序吗?
Is that in the object line a conforming program?
你的意思是主题对于
问题,这是一个不好的地方。
You mean "subject" line, and it''s a bad place for
questions.
如果是这样,为什么?
If so, why?
因为它符合符合
计划的定义在第4节第7段中。
Because it satisfies the definition of "conforming
program" in Section 4, paragraph 7.
如果没有,为什么?
If not, why?
见上文。
See above.
我希望它更像是
int main(无效)
{
for(;;);
}
但是如果我用lcc-win32编译并在其rundos.exe中运行它,它表示
程序退出后返回值为-1073741819(即-2 ^ 30 + 5)
0.032秒左右。为什么?
I''d expect it to be much like
int main(void)
{
for (;;);
}
But if I compile it with lcc-win32 and run it in its rundos.exe, it says the
program exits with a return value of -1073741819 (i.e. -2^30 + 5) after
0.032 seconds or so. Why?
可能是因为该程序超出了实施
限制。哪个限制?标准没有说,但5.2.4节中的清单
并不是详尽无遗的。 (另见
第1节第2段第5点)。
-
Er ********* @ sun.com
3月29日,11日:上午31点,Army1987 < please .... @ for.itwrote:
On Mar 29, 11:31 am, "Army1987" <please....@for.itwrote:
对象行中的符合程序吗?
如果是这样,为什么?
如果没有,为什么?
我希望它很像
int main(无效)
{
for(;;);
}
但如果我用lcc编译它-win32并在其rundos.exe中运行它,它表示
程序退出后返回值为-1073741819(即-2 ^ 30 + 5)
0.032几秒钟左右。为什么?
-
#include< stdio.h>
#include< stdlib.h>
int main(void)/ *不要在家里尝试这个* / {
const size_t dim = 256; int i;
for(i = 0; malloc(dim); i ++)/ * nothing * /;
printf("你已经完成了!%zu \ n",i * dim);
puts(" \ n\\\
- Army1987");返回0;
}
Is that in the object line a conforming program?
If so, why?
If not, why?
I''d expect it to be much like
int main(void)
{
for (;;);
}
But if I compile it with lcc-win32 and run it in its rundos.exe, it says the
program exits with a return value of -1073741819 (i.e. -2^30 + 5) after
0.032 seconds or so. Why?
--
#include <stdio.h>
#include <stdlib.h>
int main(void) /* Don''t try this at home */ {
const size_t dim = 256; int i;
for (i=0; malloc(dim); i++) /*nothing*/ ;
printf("You''re done! %zu\n", i*dim);
puts("\n\n--Army1987"); return 0;
}
埃里克回答了你的问题,我猜测了原因。>
可能,因为每次通话都要存储退货地址,你就会用完自动存储空间的
。
Eric answered your question, and I have a guess about the why part.
Probably, since each call has to store the return address, you ran out
of automatic storage.
3月29日下午3:11,user923005 < dcor ... @ connx.comwrote:
On Mar 29, 3:11 pm, "user923005" <dcor...@connx.comwrote:
3月29日上午11:31,Army1987 < please .... @ for.itwrote:
On Mar 29, 11:31 am, "Army1987" <please....@for.itwrote:
对象行中的符合程序吗?
如果是这样,为什么?
如果没有,为什么?
我希望它很像
int main(无效)
{
for(;;);
Is that in the object line a conforming program?
If so, why?
If not, why?
I''d expect it to be much like
int main(void)
{
for (;;);
}
}
但是如果我用lcc-win32编译它并在它的rundos.exe中运行它,它说
程序退出后返回值为-1073741819(即-2 ^ 30 + 5)
0.032秒或所以。为什么?
But if I compile it with lcc-win32 and run it in its rundos.exe, it says the
program exits with a return value of -1073741819 (i.e. -2^30 + 5) after
0.032 seconds or so. Why?
-
#include< stdio.h>
#include< stdlib.h>
int main(void)/ *不要在家里尝试这个* / {
const size_t dim = 256; int i;
for(i = 0; malloc(dim); i ++)/ * nothing * /;
printf("你已经完成了!%zu \ n",i * dim);
puts(" \ n\\\
- Army1987");返回0;
--
#include <stdio.h>
#include <stdlib.h>
int main(void) /* Don''t try this at home */ {
const size_t dim = 256; int i;
for (i=0; malloc(dim); i++) /*nothing*/ ;
printf("You''re done! %zu\n", i*dim);
puts("\n\n--Army1987"); return 0;
}
}
埃里克回答了你的问题,我猜对了为什么部分。
可能,因为每个电话都必须存储返回地址,所以你用完了自动存储的
。
Eric answered your question, and I have a guess about the why part.
Probably, since each call has to store the return address, you ran out
of automatic storage.
循环更可能是(i = 0; malloc(dim); i ++)/ * nothing * /;
耗尽可用的''堆''内存,系统(无论是什么,而且是BLC< wink>)强行终止程序。
致OP:我的赌注是,如果你深入挖掘,你会在返回代码上找到一些
文档,告诉你如何确定是什么
"返回值-1073741819"实际上意味着,那个文件
会引导你内存耗尽。错误终止。
HTH
-
Lew
It is more likely that the loop
for (i=0; malloc(dim); i++) /*nothing*/ ;
exhausted available ''heap'' memory, and the system (what-ever that is
wrt CLC <wink>) forcibly terminated the program.
To the OP: My bet is that, if you dig deep enough, you will find some
documentation on returncodes that tells you how to determine what a
"return value of -1073741819" actually means, and that documentation
will lead you to a "memory exhausted" error termination.
HTH
--
Lew