tags:

views:

175

answers:

4

My experience in C is mostly from second edition of The C Programming language which is a very old book. What has changed in C since it was released, what obsolete or deprecated functions should I avoid?

+2  A: 

Similar question to: http://stackoverflow.com/questions/2892951/list-of-deprecated-c-functions

There are good answers there. Look at the first comment of KennyTM.

karlphillip
+4  A: 

You can also look at the 'C' specifications that have come out since (like C99). These specs will indicate what they have added/removed/changed in relation to the previous standard.

http://en.wikipedia.org/wiki/C_%28programming_language%29

http://en.wikipedia.org/wiki/C99

http://en.wikipedia.org/wiki/C89_%28C_version%29

If you want to see what the future holds for 'C', have a look at C1X, which is the upcoming 'C' standard.

http://en.wikipedia.org/wiki/C1x

Edward Leno
+1 These are good directions too.
karlphillip
A: 

If you can grab a copy of the ISO C99 standard, the Foreword includes a nice 2-page list of major changes since C90.

ninjalj
There is a draft of C99 available on the Internet as PDF. Google "C99 pdf" and it should be the first result.
Pascal Cuoq
A: 

Not very much has changed. For most practical purposes, the language described in K&R2 is still the one to use. There has been a new C standard in 1999, but that has not been adopted as successfully and widely as the 1989 version of the standard (which K&R2 also describes).

The most important changes in C99 that could break existing programs are:

  • The implicit assumption of type int in declarations has been removed. Just make sure you always explicitly specify the types of your functions and variables.
  • Calling a function without a prior declaration is deprecated. Just make sure you declare all functions before use, preferably with a prototype.

Both of these were hold-overs from pre-standard days and have been considered bad-practice for a long time.

The one function to avoid is (and has always been) gets().

Bart van Ingen Schenau