Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      C keywords

      From cppreference.com
      <c
       
       
       
       

      This is a list of reserved keywords in C. Since they are used by the language, these keywords are not available for re-definition.As an exception, they are not considered reserved inattribute-tokens.(since C23)

      alignas(C23)
      alignof(C23)
      auto
      bool(C23)
      break
      case
      char
      const
      constexpr(C23)
      continue
      default
      do
      double
      else
      enum

      extern
      false(C23)
      float
      for
      goto
      if
      inline(C99)
      int
      long
      nullptr(C23)
      register
      restrict(C99)
      return
      short
      signed

      sizeof
      static
      static_assert(C23)
      struct
      switch
      thread_local(C23)
      true(C23)
      typedef
      typeof(C23)
      typeof_unqual(C23)
      union
      unsigned
      void
      volatile
      while

      _Alignas(C11)(deprecated in C23)
      _Alignof(C11)(deprecated in C23)
      _Atomic(C11)
      _BitInt(C23)
      _Bool(C99)(deprecated in C23)
      _Complex(C99)
      _Decimal128(C23)
      _Decimal32(C23)
      _Decimal64(C23)
      _Generic(C11)
      _Imaginary(C99)
      _Noreturn(C11)(deprecated in C23)
      _Static_assert(C11)(deprecated in C23)
      _Thread_local(C11)(deprecated in C23)

      The most common keywords that begin with an underscore are generally used through their convenience macros:

      KeywordUsed asDefined in
      _Alignas(C11)(deprecated in C23)alignas(removed in C23)stdalign.h
      _Alignof(C11)(deprecated in C23)alignof(removed in C23)stdalign.h
      _Atomic(C11)atomic_bool, atomic_int, ...stdatomic.h
      _BitInt(C23)(no macro)
      _Bool(C99)(deprecated in C23)bool(removed in C23)stdbool.h
      _Complex(C99)complexcomplex.h
      _Decimal128(C23)(no macro)
      _Decimal32(C23)(no macro)
      _Decimal64(C23)(no macro)
      _Generic(C11)(no macro)
      _Imaginary(C99)imaginarycomplex.h
      _Noreturn(C11)(deprecated in C23)noreturnstdnoreturn.h
      _Static_assert(C11)(deprecated in C23)static_assert(removed in C23)assert.h
      _Thread_local(C11)(deprecated in C23)thread_local(removed in C23)threads.h

      Some keywords are deprecated and retained as alternative spellings for compatibility purposes. These can be used wherever the keyword can.

      KeywordAlternative spelling
      alignas(C23)_Alignas(C11)(deprecated in C23)
      alignof(C23)_Alignof(C11)(deprecated in C23)
      bool(C23)_Bool(C99)(deprecated in C23)
      static_assert(C23)_Static_assert(C11)(deprecated in C23)
      thread_local(C23)_Thread_local(C11)(deprecated in C23)

      It is unspecified whether any of the spellings of these keywords, their alternate forms, ortrue andfalse is implemented as a predefined macro.

      Each name that begins with a double underscore__ or an underscore_ followed by an uppercase letter is reserved: seeidentifier for details.

      Note that digraphs<%,%>,<:,:>,%:, and%:%: provide analternative way to represent standard tokens.

      The following tokens are recognized by thepreprocessor when they are usedwithin the context of a preprocessor directive:

      if
      elif
      else
      endif

      ifdef
      ifndef
      elifdef(C23)
      elifndef(C23)
      define
      undef

      include
      embed(C23)
      line
      error
      warning(C23)
      pragma

      defined
      __has_include(C23)
      __has_embed(C23)
      __has_c_attribute(C23)

      The following tokens are recognized by the preprocessor when they are usedoutside the context of a preprocessor directive:

      _Pragma(C99)

      The following additional keywords are classified as extensions and conditionally-supported:

      asm
      fortran

      [edit]References

      • C23 standard (ISO/IEC 9899:2024):
      • 6.4.1 Keywords (p: 53)
      • J.5.9 The fortran keyword (p: 601)
      • J.5.10 The asm keyword (p: 601)
      • C17 standard (ISO/IEC 9899:2018):
      • 6.4.1 Keywords (p: 42-43)
      • J.5.9 The fortran keyword (p: 422)
      • J.5.10 The asm keyword (p: 422)
      • C11 standard (ISO/IEC 9899:2011):
      • 6.4.1 Keywords (p: 58-59)
      • J.5.9 The fortran keyword (p: 580)
      • J.5.10 The asm keyword (p: 580)
      • C99 standard (ISO/IEC 9899:1999):
      • 6.4.1 Keywords (p: 50)
      • J.5.9 The fortran keyword (p: 514)
      • J.5.10 The asm keyword (p: 514)
      • C89/C90 standard (ISO/IEC 9899:1990):
      • 3.1.1 Keywords
      • G.5.9 The fortran keyword
      • G.5.10 The asm keyword

      [edit]See also

      C++ documentation forkeywords
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/keyword&oldid=182855"

      [8]ページ先頭

      ©2009-2025 Movatter.jp