pub enum Keyword {
Show 70 variants
Auto,
Break,
Case,
Char,
Const,
Continue,
Default,
Do,
Double,
Else,
Enum,
Extern,
Float,
For,
Goto,
If,
Inline,
Int,
Long,
Register,
Restrict,
Return,
Short,
Signed,
Sizeof,
Static,
Struct,
Switch,
Typedef,
Union,
Unsigned,
Void,
Volatile,
While,
Bool,
Complex,
Imaginary,
Alignas,
Alignof,
Atomic,
Generic,
Noreturn,
StaticAssert,
ThreadLocal,
BitInt,
BoolName,
True,
False,
Nullptr,
Typeof,
TypeofUnqual,
Constexpr,
StaticAssertName,
AlignofName,
AlignasName,
ThreadLocalName,
Attribute,
Extension,
AlignofGnu,
TypeofGnu,
TypeofUnqualGnu,
Asm,
Label,
AutoType,
ThreadGnu,
Int128,
RealGnu,
ImagGnu,
InlineGnu,
RestrictGnu,
}Expand description
A C99 keyword.
Variants§
Auto
Break
Case
Char
Const
Continue
Default
Do
Double
Else
Enum
Extern
Float
For
Goto
If
Inline
Int
Long
Register
Restrict
Return
Short
Signed
Sizeof
Static
Struct
Switch
Typedef
Union
Unsigned
Void
Volatile
While
Bool
Complex
Imaginary
Alignas
Alignof
Atomic
Generic
Noreturn
StaticAssert
ThreadLocal
BitInt
BoolName
True
False
Nullptr
Typeof
TypeofUnqual
Constexpr
StaticAssertName
AlignofName
AlignasName
ThreadLocalName
Attribute
__attribute__, __attribute
Extension
__extension__
AlignofGnu
__alignof__, __alignof
TypeofGnu
__typeof__, __typeof, and typeof in a GNU dialect
TypeofUnqualGnu
__typeof_unqual__
Asm
__asm__, __asm, and asm in a GNU dialect
Label
__label__
AutoType
__auto_type
ThreadGnu
__thread
Int128
__int128
A type specifier of its own, which signed and unsigned combine
with; the __int128_t and __uint128_t spellings are typedef names
the compiler owns rather than keywords, exactly as they are in GCC.
RealGnu
__real__, __real
ImagGnu
__imag__, __imag
InlineGnu
__inline__, __inline
A variant of its own because the plain spelling is C99’s and c89!
gates it, while this one — being reserved — is available everywhere.
RestrictGnu
__restrict__, __restrict; see Keyword::InlineGnu.
Implementations§
Source§impl Keyword
impl Keyword
Sourcepub fn is_gnu(self) -> bool
pub fn is_gnu(self) -> bool
Whether this keyword is one of the GNU spellings the preprocessor introduces; see the variants’ own documentation.
Sourcepub fn since(self) -> Standard
pub fn since(self) -> Standard
The revision that made this spelling a keyword.
The C11 keywords are recognised in every mode — they are reserved
identifiers in C99, so nothing legal can be broken by it, and the
parser’s “requires C11 or later” is a better answer than a syntax
error. The C23 ones are not: they are ordinary identifiers before
C23, and <stdbool.h>’s #define bool _Bool depends on it.
The four C99 added — inline, restrict, _Bool and _Complex (with
_Imaginary beside it) — are recognised in every mode for the same
reason the C11 ones are, and gated where they are parsed; everything
else has been a keyword since C89.