Standards

I

Ian Tuomi

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?)
What is the "official" C definition nowadays? C99?
What standard does K&R 2nd edition describe?
Where can I get a book that has the latest(or best) standard?
What is the most used standard?

What books should every C programmer have? (I allready have K&R 2)

--
Ian Tuomi
Jyväskylä, Finland

"Very funny scotty, now beam down my clothes."

NOTE: Remove NOSPAM from address
 
N

Noah Roberts

Ian 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?)
What is the "official" C definition nowadays? C99?

I think so, but I loose track :p
What standard does K&R 2nd edition describe?
ansi

Where can I get a book that has the latest(or best) standard?
What is the most used standard?

What books should every C programmer have? (I allready have K&R 2)
That should do you good for the language itself, no other book I have
seen compares adiquately.

Besides that you will want something specific to certain areas of
programming, for instance you might want a Unix programmer book or
something on game programming....depending on your area of interest.
Standard C will not get you very far, you need to break away from
"stardand C" and learn other standards, like POSIX or OpenGL, to become
effective. Since this is such a wide topic I can't recommend anything,
you will want to go to a programmer group in your area of interest and
ask about good books there.
 
J

Jeremy Yallop

Ian said:
What is the "official" C definition nowadays? C99?

Yes, C99, otherwise known as ISO/IEC 9899:1999. There have also been
a couple of (very minor) updates since C99 came out.
What standard does K&R 2nd edition describe?

K&R was written shortly before C89 was released. With some small
exceptions, it describes C89.
Where can I get a book that has the latest(or best) standard?

C99 is available in electronic form from http://webstore.ansi.org and
in book form, ISBN 0470845732 (e.g. from <URL:
http://www.compman.co.uk/cgi-win/browse.exe?ref=530551> ).
What is the most used standard?

C89 is very widely implemented. There are very few conforming C99
implementations at the moment, although an increasing number of
vendors are adding at least some of the new features.

Jeremy.
 
I

Irrwahn Grausewitz

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
 
D

Dave Vandervies

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?)

It adds some features to the language that may be useful. Whether they
are in fact useful for what you want to do, combined with considerations
like availability of implementations (which will improve as time goes on),
determines whether it is in fact "better".

What is the "official" C definition nowadays? C99?

C99 (properly known as "ANSI/ISO/IEC 9899:1999", if I've gotten the order
of the organization-name TLAs in the name correct) is the most recent
formal definition and probably has the best claim to being "official".
C90 (9899:1990) is probably more useful to you as a programmer, since
it's the one that most of the implementations you'll use and most of
the code you'll work with were written for.

What standard does K&R 2nd edition describe?

C90, with a few "errors" in things that were changed between the late
drafts of the standard (which the first printing of the book was based
on) and the final version and that were missed in the update to the book.
(If you manage to find a first printing of K&R2, it in fact describes
late-draft C89. I would assume that these are fairly rare, especially
if you're buying your copy new.)

Where can I get a book that has the latest(or best) standard?

You can get C99 in electronic format from a few different standards
organizations as well as in book form, as other posters have noted.

What is the most used standard?

C90, often (but not anywhere near universally) used with extra extensions
to handle things like networking and graphics that the C standard
doesn't define.

What books should every C programmer have? (I allready have K&R 2)

K&R2 and a copy of the standard (either electronic or hard-copy) are
about the only C-specific books you'll need.

Besides language references, every programmer's library should include:
-General books on programming - Knuth is the canonical "If you're *really*
serious about it, you should get this one" book, but you'll probably
also want to get something a little bit more cookbook-ish for when
you don't have the time or energy to work through the theory behind
something. There are a lot of good books that discuss algorithms,
data structures, and program design; one or two of these will be
Very Helpful.
-References on any APIs you'll be using. A good Unix book if you're
writing Unix programs, a good Windows book if you're writing Windows
programs, a good network programming book if you're writing programs
that talk to a network, a good OpenGL book if you're using OpenGL... you
get the idea.

If you're working in a cold office, something like C for Dummies or
anything by Schildt might also be useful - if you get too cold, you can
always burn a few pages from them to keep warm.


dave
 
D

Darrell Grainger

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?)

A new standard is usually a response to people being dissatisfied with the
old standard. To some people the C99 standard might not be considered
"better" or to people who did not like features of the old standard they
might appreciate the changes in C99.
What is the "official" C definition nowadays? C99?

Not sure what you mean by "official". A lot of compilers are still using
the old standard. So does "official" mean the most widely available? Or
does it mean the last update to the standard?
What standard does K&R 2nd edition describe?

K&R 2nd edition was created before 1999 so it would be for the older
standard.
Where can I get a book that has the latest(or best) standard?

The standard can be purchased online from ISO at http://www.iso.ch/. Enter
the web site and look for a link to the ISO Store.
What is the most used standard?

I believe the most used C standard is the ISO/IEC 9899:1990 (or ANSI
9899:1989) since compilers which support 9899:1999 are harder to find.
What books should every C programmer have? (I allready have K&R 2)

A copy of the standard would be the next step.
 
I

Irrwahn Grausewitz

Ian Tuomi said:
It is based on a draft version of ANSI C89.

I wonder nobody has objected to this.

K&R1 is based on a late draft of C89.
K&R2 is based on final C89.
 
J

Jeremy Yallop

Irrwahn said:
I wonder nobody has objected to this.

Nobody objected because it's correct.
K&R1 is based on a late draft of C89.
K&R2 is based on final C89.

Nope. K&R1 was published in 1978. The ANSI standardisation process
for C began in 1983. K&R2 was published in 1988 and the first ANSI C
standard was published at the end of the following year.

Jeremy.
 
I

Irrwahn Grausewitz

Jeremy Yallop said:
Nobody objected because it's correct.


Nope. K&R1 was published in 1978. The ANSI standardisation process
for C began in 1983. K&R2 was published in 1988 and the first ANSI C
standard was published at the end of the following year.

Oh boy, now I've miscorrected my own post. <sigh>
Thanks for re-correction.
 
D

Dan Pop

In said:
Yes, C99, otherwise known as ISO/IEC 9899:1999. There have also been
a couple of (very minor) updates since C99 came out.
^^^^^^^^^^^
I'm only aware of TC1. What am I missing?

Dan
 
D

Dan Pop

In said:
Nope. K&R1 was published in 1978. The ANSI standardisation process
for C began in 1983. K&R2 was published in 1988 and the first ANSI C
standard was published at the end of the following year.

However, the 2nd and later printings of K&R2 postdate the C89 standard and
were updated to actually describe it, rather than the draft the first
printing was based on. To know which flavour of the book you have, simply
look at its cover: it clearly states whether the book is covering the
draft or the actual standard.

Note that the update was not 100% accurate, there are a few minor
differences between the draft and C89 that haven't yet been fixed in
the book.

Dan
 
J

Jeremy Yallop

Dan said:
^^^^^^^^^^^
I'm only aware of TC1. What am I missing?

Hmm. Reading that again I'm not sure what I was thinking of. Perhaps
TC2 to C90. Sorry about that.

Jeremy.
 
J

Jeremy Yallop

Dan said:
However, the 2nd and later printings of K&R2 postdate the C89 standard and
were updated to actually describe it, rather than the draft the first
printing was based on. To know which flavour of the book you have, simply
look at its cover: it clearly states whether the book is covering the
draft or the actual standard.

Thanks for the clarification.
Note that the update was not 100% accurate, there are a few minor
differences between the draft and C89 that haven't yet been fixed in
the book.

Are these things that aren't in the errata either? If so, what are
they?

Jeremy.
 
K

Keith Thompson

In <[email protected]> Jeremy Yallop


However, the 2nd and later printings of K&R2 postdate the C89 standard and
were updated to actually describe it, rather than the draft the first
printing was based on. To know which flavour of the book you have, simply
look at its cover: it clearly states whether the book is covering the
draft or the actual standard.

Note that the update was not 100% accurate, there are a few minor
differences between the draft and C89 that haven't yet been fixed in
the book.

There's also an errata list at
<http://cm.bell-labs.com/cm/cs/cbook/2ediffs.html>. I don't know
whether the published book plus the errata is 100% consistent with the
C89 (or C90) standard.
 
D

Dan Pop

In said:
Are these things that aren't in the errata either? If so, what are
they?

I suspect that, 14 years after the release of C89, all the bugs have been
reported to the authors and included in the errata. Unfortunately, they
have not been corrected in the more recent printings of the book.

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Boolean Values 16
Question on switch 16
How to find out the size of an array? 28
Getchar() problem 8
Features and standards 19
exit() values and the C standards? 33
C++ Standards 5
Downloadable standards file? 53

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top