473,796 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Different outputs in different environments.

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.
Nov 14 '05 #1
13 1443
Raja Kiran Kumar Reddy Sandireddy <sr*******@gmai l.com> wrote:
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.


Without more information to go by I can only guess, but the most
likely cause would seem to be that the program relies on some kind
of either implementation or undefined behaviour. A very simple
example would be having variables defined like this

double a;
int c[ 4 ];
char int;

and now writing past the end of array 'b' (i.e. try to use b[4]). On
some implementation/architecture it could modify the content of 'a',
on some other the content of 'c' and on another one none of them.
And there are lots and lots of similar possibilities, so without
carefully checking your program it's impossible to tell why it would
behave differently on different machines. And, of course, if you do
lots of floating point calculations you could end up with quite some
different results if the program wasn't written to deal with possible
rounding errors in a reasonable way.

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@p hysik.fu-berlin.de
\______________ ____________ http://www.toerring.de
Nov 14 '05 #2
Raja Kiran Kumar Reddy Sandireddy wrote:

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.


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

Nov 14 '05 #3
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.


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.
Nov 14 '05 #4
Hi all,

Thanks for reading and responding to the message. I got the problem
cleared. I did not initialize an allocated memory block (i used
malloc). The MSDOS environment was initialization these bytes to 0s
which would make my program run correctly while the Sun-session
compiler was initializing this to some arbitrary value. When I used
calloc, everything is working fine.

I thought of sending the program in my earlier mail so that you guys
can have a better idea of what i was talking, but it was a 500 line
program and to accompany it, it has some input files.

Anyways, thanks for responding.

-Raja Sandireddy.

sr*******@gmail .com (Raja Kiran Kumar Reddy Sandireddy) wrote in message news:<51******* *************** ****@posting.go ogle.com>...
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.

Nov 14 '05 #5
Je***********@p hysik.fu-berlin.de wrote:
A very simple example would be having variables defined like this

double a;
int c[ 4 ];
char int;

and now writing past the end of array 'b' (i.e. try to use b[4]).


Not enough coffee this morning? :)
Nov 14 '05 #6
Old Wolf <ol*****@inspir e.net.nz> wrote:
Je***********@p hysik.fu-berlin.de wrote:
A very simple example would be having variables defined like this

double a;
int c[ 4 ];
char int;

and now writing past the end of array 'b' (i.e. try to use b[4]).

Not enough coffee this morning? :)


Obviously;-) And too much editing something that (as far as I remember)
was actually at least more correct before (I started with three variables
called 'a', 'b', and 'c' and then things got a bit mixed up...)

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@p hysik.fu-berlin.de
\______________ ____________ http://www.toerring.de
Nov 14 '05 #7
Groovy hepcat Raja Kiran Kumar Reddy Sandireddy was jivin' on 1 Sep
2004 10:52:01 -0700 in comp.lang.c.
Re: Different outputs in different environments.'s a cool scene! Dig
it!
I thought of sending the program in my earlier mail so that you guys
can have a better idea of what i was talking, but it was a 500 line
program and to accompany it, it has some input files.


A man called his doctor on the phone and said, "Doc, it hurts when I
do this. Can you tell me what's wrong with me?" He then hung up. Can
you imagine what was going through the doctor's mind at that moment?
Later the man called the doctor again and said, "Doc, I would have
sent you an X-ray of my whole body, but I would have had to use a very
large envelope." What do you think the doctor thought of his patient
at that point? Do you think he was very impressed?
If you don't post code for us to analyse, how can we possibly know
what's wrong with it? If the code is too big, cut it down to the
smallest *complete* program (meaning enough to compile and run) that
shows the problem. Cut out everything that is irrelevant to solving
your problem. If it's still rather big, post it anyhow. Or, at least,
post a link to it on the 'Net. You have to give us something to go on,
otherwise there's nothing we can do for you. We're not mind readers.
Please remember that the next time you ask for help.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technicall y correct" English; but since when was rock & roll "technicall y correct"?
Nov 14 '05 #8
Peter Shaggy Haywood wrote:

Groovy hepcat Raja Kiran Kumar Reddy Sandireddy was jivin' on 1 Sep
2004 10:52:01 -0700 in comp.lang.c.
Re: Different outputs in different environments.'s a cool scene! Dig
it!
I thought of sending the program in my earlier mail so that you guys
can have a better idea of what i was talking, but it was a 500 line
program and to accompany it, it has some input files.


A man called his doctor on the phone and said, "Doc, it hurts when I
do this. Can you tell me what's wrong with me?" He then hung up. Can
you imagine what was going through the doctor's mind at that moment?


Henny Youngman.

--
pete
Nov 14 '05 #9

On Wed, 8 Sep 2004, pete wrote:

Peter Shaggy Haywood wrote:
A man called his doctor on the phone and said, "Doc, it hurts when I
do this. Can you tell me what's wrong with me?" He then hung up. Can
you imagine what was going through the doctor's mind at that moment?


Henny Youngman.


What was Henny Youngman doing, going through the doctor's mind?

-Arthur,
obviously he hung up so quickly because talking on the phone hurt him
Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2283
by: Constandinos Mavromoustakis | last post by:
CFP: CLADE 2004-Challenges of Large Applications in Distributed Environments ------------------------------------------------- PhD student - Dept.Informatics at Aristotle University of Thessaloniki URL-> http://agent.csd.auth.gr/~cmavrom -------------------------------------------------- -------------------------CLADE 2004--------------------------- Challenges of Large Applications in Distributed Environments June 7th, 2004, Honolulu,...
137
7199
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain 3) when it comes true. - 5) I have developed for many years (>18) in many different environments,...
3
1498
by: Tao.Young | last post by:
Hi, I met with a very strange problem: the same function will generate different results, but when i uncomment Line1, it'll get the same results. anyone can tell me why? the code is below(compiled with g++ 3.4.2):
0
965
by: dansan | last post by:
I have been writing some C# classes, which are in turn used by Windows forms, web services, asp.net pages, you name it. The shared classes have started to require some 'content files' (in VS deployment lingo) and places to save temp files. This is not an issue when one know that the class is going to be used only under a Windows Forms/Console application, but it becomes quite the issue when the class might be used under the web...
2
2034
by: sqlster | last post by:
We have 3 different environments: dev, qa, and production. After unit testing, the application is deployed to dev for unit testing among the programmers and business analyst. When that is okay it gets deployed to QA for other qa teams to test. When that is approved, it gets deployed to production. For each environment we have web.config in VSS such as dev.web.config, qa.web.config and so on. The developer that adds an app setting key...
4
3366
by: cantatahost | last post by:
Hello, Likely this has been asked before... We have a library (in DLL form) that we distribute. The interface to the library is all C, but within the library it uses C++ in many places. Traditionally we've built our library with VC 6. We are considering moving to VS .NET 2003 or VS 2005. However, we'd like to retain the ability to link applications with the library when the application is still built with VC 6.
6
2422
by: Joel H | last post by:
We have several settings in web.config that are different on the developer side than the production side. Our website sourcecode is under sourcesafe control, so before we code, we check out the web.config and change our connection strings to point to development databases, and change "debug=true". Before we deploy, we change everything back. We can't dynamically select the proper connection string in code because we are using the...
19
1619
by: xkenneth | last post by:
All, I seem to be having problems with running my python code, written on a Mac, on Linux and Windows boxes. It seems like the problem has to do with tab indention, particularly I've noticed that my code will completely ignore try statements. Has anyone had a similar problem? Regards, Ken
0
976
by: Chris Bordeman | last post by:
OK, I have a WCF service which might run under IIS, might also run in different environments as well. It loads assemblies from disk using LoadFrom(). As I understand it, IIS apps run under a persistent AppDomain which doesn't unload between requests. Does this mean I don't have to keep reloading the assembly? How can I detect whether the assembly needs to be reloaded?
0
9683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9529
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10457
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10231
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10013
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9054
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.