在哪里可以找到涵盖 K&R1/2、C89-C1X 及其起源的 C(和/或 C++)关键字列表?

发布于 2024-12-15 20:41:28 字数 1536 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

冷弦 2024-12-22 20:41:28

来自n3242(即C++11)

2.12关键字

表 4 — 关键词

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

表 5 — 替代表示

and      and_eq           bitand        bitor       compl
not      not_eq           or            or_eq       xor
xor_eq

n1256 (C99)

A.1.2 关键字的替代表示

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

From n3242 (ie 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 representations

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
送你一个梦 2024-12-22 20:41:28
  • and_eqalignasalignofasmautobitandbitorboolbreakcasecatchcharchar16_tchar32_tclasscomplconstconstexprconst_cast
  • 命名
  • falsefloatforfriendgotoifinlineintlongmutable
  • extern
  • 导出
  • 空间
  • newnoexceptnotnot_eqnullptr
  • 运算
  • continuedecltypedefaultdeletedoubledynamic_castelseenum
  • or_eq
  • 私有
  • 受保护的
  • 公共
  • 寄存器
  • reinterpret_cast
  • 返回
  • 签名的
  • sizeof
  • 静态
  • static_assert
  • static_cast
  • 结构
  • switch
  • template
  • this
  • thread_local
  • throw
  • true
  • try
  • typedef
  • typeid
  • typename
  • union
  • unsigned
  • using
  • virtual
  • void
  • volatile
  • wchar_t
  • while
  • xor
  • xor_eq

来自 cppreference。 com

  • auto
  • _Bool
  • break
  • case
  • char
  • _Complex
  • const
  • continue
  • default
  • do
  • double
  • else
  • enum
  • extern
  • float
  • for
  • goto
  • if
  • _Imaginary
  • inline
  • int
  • long
  • register
  • limit
  • return
  • Short
  • signed
  • sizeof
  • static
  • struct
  • switch
  • typedef
  • union
  • unsigned
  • void
  • volatile
  • while

来自维基百科

格式化这个很有趣。

  • and
  • and_eq
  • alignas
  • alignof
  • asm
  • auto
  • bitand
  • bitor
  • bool
  • break
  • case
  • catch
  • char
  • char16_t
  • char32_t
  • class
  • compl
  • const
  • constexpr
  • const_cast
  • continue
  • decltype
  • default
  • delete
  • double
  • dynamic_cast
  • else
  • enum
  • explicit
  • export
  • extern
  • false
  • float
  • for
  • friend
  • goto
  • if
  • inline
  • int
  • long
  • mutable
  • namespace
  • new
  • noexcept
  • not
  • not_eq
  • nullptr
  • operator
  • or
  • or_eq
  • 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
  • xor
  • xor_eq

from cppreference.com

  • auto
  • _Bool
  • break
  • case
  • char
  • _Complex
  • const
  • continue
  • default
  • do
  • double
  • else
  • enum
  • extern
  • float
  • for
  • goto
  • if
  • _Imaginary
  • inline
  • int
  • long
  • register
  • restrict
  • return
  • short
  • signed
  • sizeof
  • static
  • struct
  • switch
  • typedef
  • union
  • unsigned
  • void
  • volatile
  • while

from wikipedia

Formatting this was fun.

一笔一画续写前缘 2024-12-22 20:41:28

感谢您的所有答案和评论,但仅仅列出关键字并不完全是我问题的目的。尤其,

...以及它们的起源...

显然被忽视了。但在起草编码指南时,您始终需要给出每个限制的理由。

这就是为什么我开始收集自己的数据并将其放入文档中。我还在努力,特别是1995年对C90标准的AM1修订没有完全包含在内,对于C++仅使用了最新的C++11标准(部分),一些技术报告仍然需要包含等等。但是由于工作量的原因,我目前没有进行太多更新,因此我在我的网站上放置了一个草稿版本以供下载。

如果您有兴趣,请查看此处:C 语言中的保留字 (pdf)
欢迎补充和更正,联系信息在我的网站上。

FWIW。

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

... and their origins ...

has apparently been overlooked. But when drafting a coding guideline, you're always required to give a rationale for each restriction.

That's why I've started to collect my own data, and put it in a document. I'm still working on it, especially the AM1 amendment to the C90 Standard in 1995 is not fully included, for C++ only the latest C++11 Standard has been used (partly), several Technical Reports still need inclusion, etc. But since I'm currently not pursuing many updates because of workload, I've put a draft-version for download on my website.

If you're interested, look here: Reserved Words In C (pdf).
Additions and corrections are always welcome, contact info on my website.

FWIW.

骄兵必败 2024-12-22 20:41:28

C11有新关键词。其中一些是_Alignas、_Alignof。
您可以在 http://www.sdlczone.com/complete 找到完整列表-c-关键字列表/

C11 has new key words. Some of them are _Alignas, _Alignof.
You can find the complete list at http://www.sdlczone.com/complete-list-of-c-keywords/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文