Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Ansi c .... C99

  1. #1
    Join Date
    Mar 2010
    Location
    London
    Beans
    924

    Ansi c .... C99

    I've just started to have a look at C, my uni course will be using it in the up and coming semester to I decided to get a head start and read up and practise. I got a book from my uni library titled "C: How to program" (5th ed).
    I'm finding the book great so far, very well explained and I can easily skip a lot of general programming stuff (control statments etc) as I have experience in Java.

    The book however, is fairly old... it focuses on ANSI C and explains that a newer standard, C99, is now out but has not been widely adopted yet.

    My question is, as the time has passed since the publication of this book, what is the normal standard now? Has C99 made it there? or is it still usually ANSI C that is worked with?


    Thanks in advance
    - "Make me a coffee..."
    - "No"
    - "sudo make me a coffee"
    - "OK"

  2. #2
    Join Date
    May 2009
    Beans
    522

    Re: Ansi c .... C99


  3. #3
    Join Date
    Mar 2010
    Location
    London
    Beans
    924

    Re: Ansi c .... C99

    Thank you for the reply, I was just a bit confused, because when trying to compile a C program which had a for loop with the counter declaration in the for header, like so:

    Code:
    for (int i = 0; i < 10; i++) {
        //blah blah blah
    }
    .. when compiling with gcc, I get the following error:

    Code:
    error: ‘for’ loop initial declarations are only allowed in C99 mode
    - "Make me a coffee..."
    - "No"
    - "sudo make me a coffee"
    - "OK"

  4. #4
    Join Date
    Sep 2007
    Location
    Christchurch, New Zealand
    Beans
    1,328
    Distro
    Ubuntu

    Re: Ansi c .... C99

    I think C is mostly for old legacy code and new projects use C++.

    Someone here told me of the new ANSI proposal standard http://en.wikipedia.org/wiki/C%2B%2B0x but personally I prefer it stays more as a kind of portable and object oriented assembler

  5. #5
    Join Date
    Feb 2009
    Beans
    1,469

    Re: Ansi c .... C99

    Quote Originally Posted by unknownPoster View Post
    False, at least in the communities I frequent. ANSI C is C89. ISO is the standards organization responsible for all subsequent C standards, C99 included. (ANSI adopted the C99 standard in 2000, but "ANSI C" is still used to refer to the earlier standard.)

    @worksofcraft: The next C standard is in the works, often referred to as C1X, but it is in a very incomplete state. Also, C++ is not a successor to C. They hardly even compete in the same domains now-a-days, which is one reason I can see for many people thinking that C is dead (one of my pet peeves). Know that the world is larger than your back yard.

    @OP: The book is still correct; C99 is out, but has not been widely adopted in many areas C dominates. C89 is the lowest common denominator. That said, there's nothing wrong with using C99 on systems that support it, which are pretty common in their own right.

  6. #6
    Join Date
    May 2009
    Beans
    522

    Re: Ansi c .... C99

    Quote Originally Posted by trent.josephsen View Post
    False, at least in the communities I frequent. ANSI C is C89. ISO is the standards organization responsible for all subsequent C standards, C99 included. (ANSI adopted the C99 standard in 2000, but "ANSI C" is still used to refer to the earlier standard.)
    It's not false, it's just a difference in semantics and we can argue that point all day to no end.

  7. #7
    Join Date
    Mar 2005
    Beans
    947
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ansi c .... C99

    Quote Originally Posted by unknownPoster View Post
    ANSI C = C99
    C99 is an ANSI standard, yes; but when people say "ANSI C", they usually mean C89.

    Sadly, C99 is still not widely adopted. Gcc doesn't fully support it, even now.

    http://gcc.gnu.org/c99status.html

  8. #8
    Join Date
    Dec 2006
    Beans
    Hidden!

    Re: Ansi c .... C99

    Quote Originally Posted by worksofcraft View Post
    I think C is mostly for old legacy code and new projects use C++.

    Someone here told me of the new ANSI proposal standard http://en.wikipedia.org/wiki/C%2B%2B0x but personally I prefer it stays more as a kind of portable and object oriented assembler
    It always irks me that you don't seem to realize that C and C++ are different languages.

    Compile C code with gcc, and C++ with g++, understand this!

    You definitely need to forget about assembler for a while, in order to understand higher-level concepts.

  9. #9
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,288
    Distro
    Kubuntu

    Re: Ansi c .... C99

    Quote Originally Posted by KdotJ View Post
    ...

    .. when compiling with gcc, I get the following error:

    Code:
    error: ‘for’ loop initial declarations are only allowed in C99 mode
    Compile your code with either the -std=c99 or -std=gnu99 options to successfully compile your code.

    Personally, I use an alias for gcc; it is defined as follows:
    Code:
    alias gcc='gcc -Wall -pedantic -D_GNU_SOURCE -std=c99'

  10. #10
    Join Date
    Sep 2007
    Location
    Christchurch, New Zealand
    Beans
    1,328
    Distro
    Ubuntu

    Re: Ansi c .... C99

    Quote Originally Posted by Vox754 View Post
    It always irks me that you don't seem to realize that C and C++ are different languages.

    Compile C code with gcc, and C++ with g++, understand this!

    You definitely need to forget about assembler for a while, in order to understand higher-level concepts.
    lol

    IMO C++ is a super set of C. C is obsolete. They are both just portable assembler and I never use gcc. If I ever should want anything different... well Python is quite a cute little interpreter I suppose

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •