Where can I find a list of C keywords (and / or C ++) covering K & R1 / 2, C89-C1X and their origin?

I was acquainted with numerous coding instructions, each of which gave recommendations on the name of "things". One specific C89 naming rule raised this question: it was explicitly forbidden to use the name "new" for a variable, because in C ++ it is a keyword.

It made me think about the following standards, the C99 is well documented, but the C11 is relatively new (2014). And the Standards Committee has several extensions that are still in the works.

Therefore, I am wondering if anyone can provide a list with keywords and their origin in order to create a set of naming rules, including reasons why several names should be avoided.

Although, strictly speaking, complex not a keyword, similar definitions are best included. And C ++ information is also welcome.

+4
source share
4 answers

Thanks for all the answers and comments, but just having a list of keywords was not quite my intention. Special,

... and their origin ...

apparently missed. But when compiling a coding guide, you always need to provide justification for each limitation.

That's why I started collecting my own data and putting it in a document. I'm still working on this, especially the AM1 amendment to the C90 standard in 1995 was not fully included, for C ++ only the latest C ++ 11 standard was used (partially), several technical reports still need to be included, etc. But since I am not currently pursuing a lot of updates due to the workload, I put a draft version to download on my site.

If you're interested, look here: Reserved words in C (pdf) . Additions and corrections are always welcome, contact information on my site.

FWIW.

0
source

From n3242 (i.e. C ++ 11)

2.12 Keywords

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 Views

 and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq 

From n1256 (C99)

A.1.2 Keywords

 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 
+6
source
  • and
  • and_eq
  • alignas
  • alignof
  • ASM
  • auto
  • bitand
  • bitor
  • Bool
  • break
  • happening
  • to catch
  • char
  • char16_t
  • char32_t
  • class
  • set
  • Const
  • constexpr
  • const_cast
  • continue
  • decltype
  • Default
  • remove
  • double
  • dynamic_cast
  • yet
  • enum
  • Explicit
  • Export
  • exhp
  • Lying
  • float
  • for
  • friend
  • Goto
  • if
  • in-line
  • INT
  • long
  • mutable
  • Namespace
  • new
  • noexcept
  • not
  • not_eq
  • nullptr
  • Operator
  • or
  • or_eq
  • private
  • protected
  • the public
  • Register
  • reinterpret_cast
  • return
  • short
  • signed
  • Sizeof
  • static
  • static_assert
  • static_cast
  • structure
  • Switch
  • template
  • this is
  • thread_local
  • throw
  • True
  • to try
  • Jureye
  • Typeid
  • Type Name
  • an association
  • unsigned
  • using buttons
  • virtual
  • invalid
  • volatile
  • wchar_t
  • a
  • exclusive
  • xor_eq

from cppreference.com

  • auto
  • _Bool
  • break
  • happening
  • char
  • _Complex
  • Const
  • continue
  • Default
  • to do
  • double
  • yet
  • transfer
  • exhp
  • float
  • for
  • Goto
  • if
  • _Imaginary
  • in-line
  • INT
  • long
  • Register
  • restriction
  • return
  • short
  • signed
  • Sizeof
  • static
  • structure
  • Switch
  • Jureye
  • an association
  • unsigned
  • invalid
  • volatile
  • until

from wikipedia

Formatting was fun.

+2
source

C11 has new keywords. Some of them are Alinhas, Alinjof. A complete list can be found at http://www.sdlczone.com/complete-list-of-c-keywords/

0
source

Source: https://habr.com/ru/post/1381335/


All Articles