C99 in cc

This is a discussion on C99 in cc within the C Programming forums, part of the General Programming Boards category; When you use cc in *nix distros is it up to date with the C99 standard?...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    266

    C99 in cc

    When you use cc in *nix distros is it up to date with the C99 standard?

  2. #2
    Registered User
    Join Date
    Jul 2007
    Posts
    131
    Depends on what compiler cc actually is.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    In Linux, cc is gcc - which has pretty near all of C99's features - I don't really know which parts are missing. I'm sure it's documents on the gcc.org website.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Jun 2008
    Posts
    266
    Thanks a lot. Just what I needed.

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    to compile C99 in gcc, use -std=c99.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by robwhit View Post
    to compile C99 in gcc, use -std=c99.
    But the default is gcc's version of C99 if you don't specify anything, so C99 code will compile OK with that (and then some gcc specific extensions). Of course, if you want to make sure it's C99 compatible, you shold speciy -sdc=c99.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    gcc's manual says the default it gnu89, not gnu99, and that there are some conflicts between GNU's extensions and the standards. So if you want C99 compatibility fo sho, then use c99, but the default might get you by, like Mats says.

    http://gcc.gnu.org/onlinedocs/gcc-4....html#Standards
    Last edited by robwhit; 08-31-2008 at 02:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C89 or C99
    By talin in forum C Programming
    Replies: 6
    Last Post: 05-26-2008, 01:45 PM
  2. C99 and int main()
    By cwr in forum C Programming
    Replies: 8
    Last Post: 09-19-2005, 07:54 AM
  3. Problems about gcc installation
    By kevin_cat in forum Linux Programming
    Replies: 4
    Last Post: 08-09-2005, 10:05 AM
  4. My first game
    By homeyg in forum Game Programming
    Replies: 20
    Last Post: 12-22-2004, 05:25 PM
  5. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 07:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21