A question about C program in Linux and Windows

Discussion in 'C Programming' started by Chang, Sep 17, 2005.

  1. Chang

    Chang Guest

    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
     
    Chang, Sep 17, 2005
    #1
    1. Advertising

  2. Chang

    Jaspreet Guest

    Chang wrote:
    > 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.
    >

    [snip..]
    > Chang


    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.
     
    Jaspreet, Sep 17, 2005
    #2
    1. Advertising

  3. Chang

    Jack Klein Guest

    On 16 Sep 2005 19:10:42 -0700, "Chang" <> wrote in
    comp.lang.c:

    > 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?


    There is a missing semicolon on line 42.

    > 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


    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/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Sep 17, 2005
    #3
  4. Chang

    Tim Prince Guest

    Jaspreet wrote:
    > Chang wrote:
    >
    >>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.
    >>

    >
    > [snip..]
    >
    >>Chang

    >
    >
    > 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.
    >

    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).
     
    Tim Prince, Sep 17, 2005
    #4
  5. Chang wrote on 17/09/05 :
    > 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?


    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
     
    Emmanuel Delahaye, Sep 17, 2005
    #5
  6. Chang wrote:
    > 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.


    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.
    $
     
    Martin Ambuhl, Sep 17, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Davy

    Linux program use times() to Windows

    Davy, Dec 11, 2005, in forum: C Programming
    Replies:
    4
    Views:
    385
    Kenny McCormack
    Dec 11, 2005
  2. SagharAyyaz
    Replies:
    1
    Views:
    492
    Jonathan Mcdougall
    May 9, 2006
  3. marcpp
    Replies:
    5
    Views:
    286
  4. Levi Campbell
    Replies:
    3
    Views:
    287
    Nicol van der Merwe
    Jul 20, 2008
  5. Krishna Chaitanya
    Replies:
    1
    Views:
    148
    Krishna Chaitanya
    Feb 27, 2009
Loading...

Share This Page