Connecting Tech Pros Worldwide Forums | Help | Site Map

A question about C program in Linux and Windows

Chang
Guest
 
Posts: n/a
#1: Nov 15 '05
I wrote a C program only for calculation
using MS visual studio and run it in Windows.
With small size of variables, it runs o.k.
with large size of variables, however, it stop abnormally.

I guess it might come from memory leakage.
So, I check it out pretty throughly but I could not
find any memory allocation and free type problem.

so, I run it in Linux and it works fine with large size of variables
which are big enough to run for a day.

I understand C programs run same way in windows and Linux.
I am confused what make it happen.
Here is my questions,

Q1) What mistake might I make?
Q2) How come it doesn't have amy problem with Linux?
Q3) If it is still memory leakage problems, what is easier way
to detect them?
Q4) Is there any thing I need to consider to run C program in
different OS?

If you have any simliar experience, Please, give me some clue or
help?

Have a nice day.
And Thanks for your time.

Chang


Jaspreet
Guest
 
Posts: n/a
#2: Nov 15 '05

re: A question about C program in Linux and Windows



Chang wrote:[color=blue]
> I wrote a C program only for calculation
> using MS visual studio and run it in Windows.
> With small size of variables, it runs o.k.
> with large size of variables, however, it stop abnormally.
>[/color]
[snip..][color=blue]
> Chang[/color]

If the program is a small program then please paste the code here so
that we can tell you the possible reasons for the strange behavior.

Jack Klein
Guest
 
Posts: n/a
#3: Nov 15 '05

re: A question about C program in Linux and Windows


On 16 Sep 2005 19:10:42 -0700, "Chang" <cckbyun@gmail.com> wrote in
comp.lang.c:
[color=blue]
> I wrote a C program only for calculation
> using MS visual studio and run it in Windows.
> With small size of variables, it runs o.k.
> with large size of variables, however, it stop abnormally.
>
> I guess it might come from memory leakage.
> So, I check it out pretty throughly but I could not
> find any memory allocation and free type problem.
>
> so, I run it in Linux and it works fine with large size of variables
> which are big enough to run for a day.
>
> I understand C programs run same way in windows and Linux.
> I am confused what make it happen.
> Here is my questions,
>
> Q1) What mistake might I make?[/color]

There is a missing semicolon on line 42.
[color=blue]
> Q2) How come it doesn't have amy problem with Linux?
> Q3) If it is still memory leakage problems, what is easier way
> to detect them?
> Q4) Is there any thing I need to consider to run C program in
> different OS?
>
> If you have any simliar experience, Please, give me some clue or
> help?
>
> Have a nice day.
> And Thanks for your time.
>
> Chang[/color]

I'm afraid that my crystal ball is out being cleaned and pressed.

If you are looking at your code and cannot see what is wrong with it,
how do you expect someone else to figure it out when we can't even see
the code?

You haven't even told us what "stops abnormally" means.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Tim Prince
Guest
 
Posts: n/a
#4: Nov 15 '05

re: A question about C program in Linux and Windows


Jaspreet wrote:[color=blue]
> Chang wrote:
>[color=green]
>>I wrote a C program only for calculation
>>using MS visual studio and run it in Windows.
>>With small size of variables, it runs o.k.
>>with large size of variables, however, it stop abnormally.
>>[/color]
>
> [snip..]
>[color=green]
>>Chang[/color]
>
>
> If the program is a small program then please paste the code here so
> that we can tell you the possible reasons for the strange behavior.
>[/color]
We may need, in addition, the <float.h> from each system to get clues,
without venturing into "off topic" but relevant questions, such as
whether you chose to generate x87 code on linux and sse on Windows (or
didn't think about consequences of inconsistent defaults).
Emmanuel Delahaye
Guest
 
Posts: n/a
#5: Nov 15 '05

re: A question about C program in Linux and Windows


Chang wrote on 17/09/05 :[color=blue]
> Q1) What mistake might I make?
> Q2) How come it doesn't have amy problem with Linux?
> Q3) If it is still memory leakage problems, what is easier way
> to detect them?
> Q4) Is there any thing I need to consider to run C program in
> different OS?[/color]

My mind reader device being under repair, please post your code...

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"It's specified. But anyone who writes code like that should be
transmogrified into earthworms and fed to ducks." -- Chris Dollin CLC


Martin Ambuhl
Guest
 
Posts: n/a
#6: Nov 15 '05

re: A question about C program in Linux and Windows


Chang wrote:[color=blue]
> I wrote a C program only for calculation
> using MS visual studio and run it in Windows.
> With small size of variables, it runs o.k.
> with large size of variables, however, it stop abnormally.
>
> I guess it might come from memory leakage.
> So, I check it out pretty throughly but I could not
> find any memory allocation and free type problem.[/color]

With the information you have provided, I have meditated on your
problem. This is the best I can come up with:

$oracle -m -w1 -w2 -nc
- -
- -
---
- -
---
---
[Mawandui Text (Shaughnessy)]
29. Guimei "Returning Maiden"
Returning maiden.
To be upright is inauspicious;
there is no place beneficial.

[WangBi Text (Baynes/Wilhelm)]
54. Guimei "The Marrying Maiden"
(Dui/The Joyous/Lake Below, Zhen/The Arousing/Thunder Above)
The Marrying Maiden.
Undertakings bring misfortune.
Nothing that would further.

[WangBi Text (Lynn)]
54. Guimei "Marrying Maid"
(Dui/Lake Below, Zhen/Thunder Above)
The Marrying Maiden is such that
to set forth would mean misfortune.
There is nothing at all fitting here.

There are no transforming lines today.
$
Closed Thread