C keeps a small set of keywords for its own use. These keywords cannot be used as identifiers in the program — a common restriction with modern languages. Where users of Old C may be surprised is in the introduction of some new keywords; if those names were used as identifiers in previous programs, then the programs will have to be changed. It will be easy to spot, because it will provoke your compiler into telling you about invalid names for things. Here is the list of keywords used in Standard C; you will notice that none of them use upper-case letters.
auto | double | int | struct |
break | else | long | switch |
case | enum | register | typedef |
char | extern | return | union |
const | float | short | unsigned |
continue | for | signed | void |
default | goto | sizeof | volatile |
do | if | static | while |
The new keywords that are likely to surprise old programmers are:
const
, signed
, void
and volatile
(although void
has been around for a while). Eagle eyed readers may have noticed that some implementations of C used to use the keywords entry
, asm
, and fortran
. These are not part of the Standard, and few will mourn them.
No comments:
Post a Comment