I've been exposed to numerous coding guidelines, every one of them giving guidelines for naming 'things'. One specific C89 naming rule triggered this question: It was explicitly forbidden to use the name 'new' for a variable, because in C++ this is a keyword.
This started me thinking about the next standards, C99 is well documented, but C11 is relatively new (2014). And the Standards committee has several extensions still in the works.
Therefore I'm wondering if someone can provide a list with keywords and their origins, in order to make a set of naming rules, including the reasons why several names are to be avoided.
And although strictly spoken complex
is not a keyword, similar definitions would best be included. And C++ information is also appreciated.
Table 4 — Keywords
alignas alignof asm auto bool
break case catch char char16_t
char32_t class const constexpr const_cast
continue decltype default delete double
do dynamic_cast else enum explicit
export extern false float for
friend goto if inline int
long mutable namespace new noexcept
nullptr operator private protected public
register reinterpret_cast return short signed
sizeof static static_assert static_cast struct
switch template this thread_local throw
true try typedef typeid typename
union unsigned using virtual void
volatile wchar_t while
Table 5 — Alternative representations
and and_eq bitand bitor compl
not not_eq or or_eq xor
xor_eq
auto enum break extern case
float char for const goto
continue if default inline do
int double long else register
restrict return short signed sizeof
static struct switch typedef union
unsigned void volatile while _Bool
_Complex _Imaginary
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With