Difference between revisions of "c/keyword"
(ohh, missed an optional C89 keyword "fortran") |
(partial undo.. mentioning it as a note instead (it's still there in C11).. also asm was never mentinoed here.) |
||
Line 22: | Line 22: | ||
{{rlt|float}}<br> | {{rlt|float}}<br> | ||
{{rlt|for}}<br> | {{rlt|for}}<br> | ||
− | |||
{{rlt|goto}}<br> | {{rlt|goto}}<br> | ||
{{rlt|if}}<br> | {{rlt|if}}<br> | ||
Line 136: | Line 135: | ||
{{ltt|c/preprocessor/impl|_Pragma}}{{mark since c99}} | {{ltt|c/preprocessor/impl|_Pragma}}{{mark since c99}} | ||
|} | |} | ||
+ | |||
+ | The following additional keywords are supported as common extensions: | ||
+ | |||
+ | * {{c|fortran}}, type specifier used in function declarations and other external declarations to indicate Fortran language linkage. | ||
+ | * {{c|asm}}, inserts [[c/language/asm|inline assembly language]] fragments | ||
===References=== | ===References=== |
Revision as of 06:15, 10 February 2015
This is a list of reserved keywords in C. Since they are used by the language, these keywords are not available for re-definition.
|
|
|
|
The most common keywords that begin with an underscore are generally used through their convenience macros:
keyword | used as | defined in |
_Alignas (since C11)
|
alignas | stdalign.h
|
_Alignof (since C11)
|
alignof | stdalign.h
|
_Atomic (since C11)
|
atomic_bool. atomic_int, ... | stdatomic.h
|
_Bool (since C99)
|
bool | stdbool.h
|
_Complex (since C99)
|
complex | complex.h
|
_Generic (since C11)
|
(no macro) | |
_Imaginary (since C99)
|
imaginary | complex.h
|
_Noreturn (since C11)
|
noreturn | stdnoreturn.h
|
_Static_assert (since C11)
|
static_assert | assert.h
|
_Thread_local (since C11)
|
thread_local | threads.h
|
Also, each name that begins with a double underscore __ or an underscore followed by an uppercase letter is reserved: see identifier for details.
Note that digraphs <%
, %>
, <:
, :>
, %:
, and %:%:
provide an alternative way to represent standard tokens.
The following tokens are recognized by the preprocessor when they are used within the context of a preprocessor directive:
The following tokens are recognized by the preprocessor when they are used outside the context of a preprocessor directive:
_Pragma(since C99) |
The following additional keywords are supported as common extensions:
- fortran, type specifier used in function declarations and other external declarations to indicate Fortran language linkage.
- asm, inserts inline assembly language fragments
References
- C11 standard (ISO/IEC 9899:2011):
- 6.4.1 Keywords (p: 58-59)
- C99 standard (ISO/IEC 9899:1999):
- 6.4.1 Keywords (p: 50)
- C89/C90 standard (ISO/IEC 9899:1990):
See also
C++ documentation for C++ keywords
|