开发者

What has changed since “The C Programming Language”

开发者 https://www.devze.com 2023-01-13 05:48 出处:网络
My experience in C is开发者_JS百科 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

My experience in C is开发者_JS百科 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?


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


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


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().

0

精彩评论

暂无评论...
验证码 换一张
取 消