#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    3
    Rep Power
    0

    Compilation error


    what is missing with the following code snippet, it's not compiling with gnu c...? :confused:


    int safe_add( int a, int b )
    {
    int c = a + b;
    if ( a >= 0 && b >= 0 && c < 0 )
    {
    fprintf ( stderr, "Overflow!\n" );
    }
    if ( a < 0 && b < 0 && c >= 0 )
    {
    fprintf ( stderr, "Underflow!\n" );
    }
    return c;
    }
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    There is no main function. The program need a main function.

    Now, if you are getting a different error message, then post a copy of it here!

    We're not frakking mind-readers!
  4. #3
  5. Commie Mutant Traitor
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Location
    Norcross, GA (again)
    Posts
    1,805
    Rep Power
    1570
    As dwise1_aol says, we need more information about this to be able to even to try and answer this.
    Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
    #define KINSEY (rand() % 7) λ Scheme is the Red Pill
    Scheme in Short Understanding the C/C++ Preprocessor
    Taming Python A Highly Opinionated Review of Programming Languages for the Novice, v1.1

    FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov

IMN logo majestic logo threadwatch logo seochat tools logo