Ian Tuomi said:
Hello. I have been reading about all the different standards in C and I
am quite confused, and have a few questions. ()
How is C99 "better" than older versions of C? (or is it?)
That's a list of changes, taken from the current standard itself:
[...] Major changes from the previous edition include:
— restricted character set support via digraphs and <iso646.h>
(originally specified in AMD1)
— wide character library support in <wchar.h> and <wctype.h> (originally
specified in AMD1)
— more precise aliasing rules via effective type
— restricted pointers
— variable-length arrays
— flexible array members
— static and type qualifiers in parameter array declarators
— complex (and imaginary) support in <complex.h>
— type-generic math macros in <tgmath.h>
— the long long int type and library functions
— increased minimum translation limits
— additional floating-point characteristics in <float.h>
— remove implicit int
— reliable integer division
— universal character names (\u and \U)
— extended identifiers
— hexadecimal floating-point constants and %a and %A printf/scanf
conversion specifiers
— compound literals
— designated initializers
— // comments
— extended integer types and library functions in <inttypes.h> and
<stdint.h>
— remove implicit function declaration
— preprocessor arithmetic done in intmax_t/uintmax_t
— mixed declarations and code
— new block scopes for selection and iteration statements
— integer constant type rules
— integer promotion rules
— macros with a variable number of arguments
— the vscanf family of functions in <stdio.h> and <wchar.h>
— additional math library functions in <math.h>
— floating-point environment access in <fenv.h>
— IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
— trailing comma allowed in enum declaration
— %lf conversion specifier allowed in printf
— inline functions
— the snprintf family of functions in <stdio.h>
— boolean type in <stdbool.h>
— idempotent type qualifiers
— empty macro arguments
— new struct type compatibility rules (tag compatibility)
— additional predefined macro names
— _Pragma preprocessing operator
— standard pragmas
— _ _func_ _ predefined identifier
— VA_COPY macro
— additional strftime conversion specifiers
— LIA compatibility annex
— deprecate ungetc at the beginning of a binary file
— remove deprecation of aliased array parameters
— conversion of array to pointer not limited to lvalues
— relaxed constraints on aggregate and union initialization
— relaxed restrictions on portable header names
— return without expression not permitted in function that returns a
value (and vice versa)
What is the "official" C definition nowadays? C99?
ISO/IEC 9899:1999, short C99
What standard does K&R 2nd edition describe?
It is based on a draft version of ANSI C89.
Where can I get a book that has the latest(or best) standard?
The standard itself, of course:
The C Standard
by British Standards Institute
Published by John Wiley & Sons Ltd
750+ pages
ISBN 0-470-84573-2
I paid 55,- EUR at my local book store. It's worth it.
Also available as PDF document, you should be able to find the order
form via
http://www.dkuug.dk/JTC1/SC22/WG14/.
What is the most used standard?
Currently C89/C90, as of now there are only few (no?) fully conforming
implementations of C99.
What books should every C programmer have? (I allready have K&R 2)
K&R2 will do fine, especially when accompanied by the standard itself.
You can find more recommendations in Section 20 of the c.l.c-faq,
residing at
http://www.eskimo.com/~scs/C-faq/top.html .
HTH
Regards