不同环境下的不同产出。 [英] Different outputs in different environments.

查看:55
本文介绍了不同环境下的不同产出。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我发现程序输出有一个非常奇怪的现象。我在MSDOS环境中运行了我的C程序和在Sun会话上使用相同的程序。

当输入是一个小文件时我得到相同的输出(其中有详细信息

用于具有(例如,少于30个逻辑门)的电路。但是,相同的

程序在这些环境中以不同的方式处理输入,并在输入文件描述更大的电路时给出

不同的结果(例如,

超过100门)。我使用大量内存将数据保存在

文件中然后处理它。

程序的输出是MSDOS中预期的(正确的)

环境,而UNIX环境的输出不是

预期的。


任何人都可以向我澄清这一点。


谢谢,

Raja Sandireddy。

Hi,

I observed a very strange phenomenon with my program outputs. I run
my C-program on MSDOS environment and the same program on Sun-session.
I get same output when the input is a small file (which has details
for a circuit with, say, less than 30 logic gates). But, the same
program processes the inputs differently in these environment and give
different results when the input file describes a larger circuit (say,
more than 100 gates). I use lot of memory to hold the data in the
file and then process it.
The program''s output is the expected (correct) one in the MSDOS
environment, while the output with the UNIX environment is not the
expected one.

Can anyone clarify this to me.

Thanks,
Raja Sandireddy.

推荐答案

Raja Kiran Kumar Reddy Sandireddy < SR ******* @ gmail.com>写道:
Raja Kiran Kumar Reddy Sandireddy <sr*******@gmail.com> wrote:
我发现我的程序输出有一个非常奇怪的现象。我在MSDOS环境中运行我的C程序,在Sun会话上运行相同的程序。
当输入是一个小文件时,我得到相同的输出(具有电路的详细信息),比方说,少于30个逻辑门)。但是,相同的程序在这些环境中以不同的方式处理输入,并在输入文件描述更大的电路(例如,超过100个门)时给出不同的结果。我使用大量内存来保存
文件中的数据,然后对其进行处理。
程序的输出是MSDOS
环境中预期的(正确的)输出,而输出与UNIX环境不是预期的。
I observed a very strange phenomenon with my program outputs. I run
my C-program on MSDOS environment and the same program on Sun-session.
I get same output when the input is a small file (which has details
for a circuit with, say, less than 30 logic gates). But, the same
program processes the inputs differently in these environment and give
different results when the input file describes a larger circuit (say,
more than 100 gates). I use lot of memory to hold the data in the
file and then process it.
The program''s output is the expected (correct) one in the MSDOS
environment, while the output with the UNIX environment is not the
expected one.




如果没有更多的信息,我只能猜测,但最多的是

可能的原因似乎是该程序依赖于某种实现或未定义行为的某种类型。一个非常简单的

示例将是这样定义的变量


double a;

int c [4];

char int;


现在写入数组b的末尾(即尝试使用b [4])。在某些实现/体系结构上它可以修改''a''的内容,

在'c'的其他一些内容上,另一个没有他们。

并且有很多类似的可能性,所以没有

仔细检查你的程序就不可能告诉它为什么会这样。 $ b在不同的机器上表现不同。而且,当然,如果你做了大量的浮点计算,你可能会得到相当多的不同结果,如果程序没有被写入来处理可能的话

以合理的方式舍入错误。


问候,Jens

-

\ Jens Thoms Toerring ___ Je***********@physik.fu- berlin.de

\ __________________________ http:// www。 toerring.de


Raja Kiran Kumar Reddy Sandireddy写道:
Raja Kiran Kumar Reddy Sandireddy wrote:

我观察到一个非常奇怪的现象输出。我在MSDOS环境中运行我的C程序,在Sun会话上运行相同的程序。
当输入是一个小文件时,我得到相同的输出(具有电路的详细信息),比方说,少于30个逻辑门)。但是,相同的程序在这些环境中以不同的方式处理输入,并在输入文件描述更大的电路(例如,超过100个门)时给出不同的结果。我使用大量内存来保存
文件中的数据,然后对其进行处理。
程序的输出是MSDOS
环境中预期的(正确的)输出,而输出UNIX环境不是预期的。

任何人都可以向我澄清这一点。

I observed a very strange phenomenon with my program outputs. I run
my C-program on MSDOS environment and the same program on Sun-session.
I get same output when the input is a small file (which has details
for a circuit with, say, less than 30 logic gates). But, the same
program processes the inputs differently in these environment and give
different results when the input file describes a larger circuit (say,
more than 100 gates). I use lot of memory to hold the data in the
file and then process it.
The program''s output is the expected (correct) one in the MSDOS
environment, while the output with the UNIX environment is not the
expected one.

Can anyone clarify this to me.




您调用了未定义的行为。检查第456行。


-

丘吉尔和布什都可以被视为战时领导者,只需

作为秘书处和埃德先生都是马。 - 詹姆斯罗德斯。

我们一直都知道,不顾一切的自我利益是坏的

道德。我们现在知道这是糟糕的经济学 - FDR



You have invoked undefined behavior. Check line 456.

--
"Churchill and Bush can both be considered wartime leaders, just
as Secretariat and Mr Ed were both horses." - James Rhodes.
"We have always known that heedless self-interest was bad
morals. We now know that it is bad economics" - FDR


2004年8月31日23:03:34 -0700
sr ******* @ gmail.com (Raja Kiran Kumar Reddy Sandireddy)写道:


< snip程序描述这不适用于没有代码>
On 31 Aug 2004 23:03:34 -0700
sr*******@gmail.com (Raja Kiran Kumar Reddy Sandireddy) wrote:

<snip description of program that does not work with no code>
任何人都可以向我澄清这一点。
Can anyone clarify this to me.




前往最近的酿酒厂套件供应商并购买一些澄清器。

或者,发布展示

问题的最低COMPILABLE程序,我们可能会提供帮助。但是,所有人都可以在

时刻说你有问题。

-

Flash Gordon

有时候我觉得拍摄对某些人来说太好了。

虽然我的电子邮件地址说垃圾邮件,但它是真实的,我读了它。



Go down to your nearest wine making kit supplier and buy some clarifier.
Alternatively, post the minimum COMPILABLE program that exhibits the
problem and we may be able to help. However, all anyone can say at the
moment is that you have a problem.
--
Flash Gordon
Sometimes I think shooting would be far too good for some people.
Although my email address says spam, it is real and I read it.


这篇关于不同环境下的不同产出。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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