Thread: C99 Questions

  1. #1
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511

    C99 Questions

    Three Questions about C99- For those of you in non-academia.



    1. Do you use a compiler or know of any compiler that supports C99. Which is new C standard.


    2. Would you use (if supported) the new macro bool found in <stdbool.h> or the unsigned integer _Bool


    3. The main() method:

    In the Harbison and Steel C reference manual (found in other manuals as well: it says


    int main(void) { }
    int main() { } /*also OK, but not recommended */
    int main(int argc, char *argv[]) {}

    "Standard C permitd main to be defined with either zero or two parameters"
    Fine- I agree with this- but why the comment mentioned "not recommended" given here? Thoughts and insight please

    As you know I teach C at the college level and these are some questions we as a faculty are interested as we prepare for our Fall C classes.

    Mr. C.
    Mr. C: Author and Instructor

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >1. Do you use a compiler or know of any compiler that supports C99.
    GCC has taken steps to conform to C99, you can find their progress at the gnu site.

    >2. Would you use (if supported) the new macro bool found in <stdbool.h> or the unsigned integer _Bool
    If possible I would use the standard macro if only to ensure portability. Though if my code were likely to be run by non-C99 compilers I would have to choose the option that would work across as many compilers as possible.

    >but why the comment mentioned "not recommended" given here? Thoughts and insight please
    In C90 as well as C99 declaring main with an empty argument list is not recommended. The reason is that an empty list means "unknown number and type of arguments" whereas void specifies "no arguments". The two meanings are wildly different, wouldn't you agree?

    >these are some questions we as a faculty are interested as we prepare for our Fall C classes.
    In that case, for question 2 I suggest you teach the C99 method but also make your students aware of alternatives if they don't use a conformant compiler.
    My best code is written with the delete key.

  3. #3
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    Quick question...

    Does the empty arguments function have the same meaning in C++ as it does in C? Would int func(void) be legal in C++?

  4. #4
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511
    Prelude, yes I do agree. Thanks for the insight. I don't hardcore program any more so getting insight from others helps.
    Mr. C: Author and Instructor

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I'd go ahead and teach the C99 standard. Eventually m$ will conform to it (most likely when the next standard is published) and in any event your students may develop new compilers that should conform to the standard. Of course Prelude is right about the "awareness" issue. I notice a lot of people use some older compilers that pre-date the standard. And there are a large number of VC++ users too.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  2. C99 and int main()
    By cwr in forum C Programming
    Replies: 8
    Last Post: 09-19-2005, 06:54 AM
  3. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  4. My first game
    By homeyg in forum Game Programming
    Replies: 20
    Last Post: 12-22-2004, 05:25 PM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM