Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      Type support

      From cppreference.com
      <c
       
       
       

      See alsotype system overview andarithmetic types defined by the language.

      Contents

      [edit]Basic types

      [edit]Additional basic types and convenience macros

      Defined in header<stddef.h>
      unsigned integer type returned by thesizeof operator
      (typedef)[edit]
      signed integer type returned when subtracting two pointers
      (typedef)[edit]
      the type of the predefined null pointer constantnullptr
      (typedef)[edit]
      implementation-defined null pointer constant
      (macro constant)[edit]
      a type with alignment requirement as great as any other scalar type
      (typedef)[edit]
      byte offset from the beginning of a struct type to specified member
      (function macro)[edit]
      Defined in header<stdbool.h>
      bool
      (C99)(removed in C23)
      convenience macro, expands to_Bool
      (keyword macro)
      true
      (C99)(removed in C23)
      expands to integer constant1
      (macro constant)
      false
      (C99)(removed in C23)
      expands to integer constant0
      (macro constant)
      __bool_true_false_are_defined
      (C99)(deprecated in C23)
      expands to integer constant1
      (macro constant)
      Defined in header<stdalign.h>
      alignas
      (C11)(removed in C23)
      convenience macro, expands to keyword_Alignas
      (keyword macro)
      alignof
      (C11)(removed in C23)
      convenience macro, expands to keyword_Alignof
      (keyword macro)
      __alignas_is_defined
      (C11)(removed in C23)
      expands to integer constant1
      (macro constant)
      __alignof_is_defined
      (C11)(removed in C23)
      expands to integer constant1
      (macro constant)
      Defined in header<stdnoreturn.h>
      noreturn
      (C11)(deprecated in C23)
      convenience macro, expands to_Noreturn
      (keyword macro)

      [edit]Fixed width integer types(since C99)

      [edit]Numeric limits

      [edit]Notes

      The type oftrue andfalse isint rather than_Bool.

      A program may undefine and perhaps then redefine the macrosbool,true andfalse. However, such ability is a deprecated feature.

      (since C99)
      (until C23)

      The type oftrue andfalse isbool. It is unspecified whether any ofbool,_Bool,true, orfalse is implemented as a predefined macro.

      Ifbool,true, orfalse (but not_Bool) is defined as a predefined macro, a program may undefine and perhaps redefine it.

      (since C23)

      [edit]Example

      Run this code
      #include <stdalign.h>#include <stdbool.h>#include <stdio.h> int main(void){printf("%d %d %d\n",true&&false,true||false,!false);printf("%d %d\n",true^true,true+true);printf("%zu\n", alignof(short));}

      Possible output:

      0 1 10 22

      [edit]References

      • C23 standard (ISO/IEC 9899:2024):
      • 7.15 Alignment <stdalign.h> (p: TBD)
      • 7.18 Boolean type and values <stdbool.h> (p: TBD)
      • 7.19 Common definitions <stddef.h> (p: TBD)
      • 7.23 _Noreturn <stdnoreturn.h> (p: TBD)
      • 7.31.9 Boolean type and values <stdbool.h> (p: TBD)
      • C17 standard (ISO/IEC 9899:2018):
      • 7.15 Alignment <stdalign.h> (p: 196)
      • 7.18 Boolean type and values <stdbool.h> (p: 210)
      • 7.19 Common definitions <stddef.h> (p: 211)
      • 7.23 _Noreturn <stdnoreturn.h> (p: 263)
      • 7.31.9 Boolean type and values <stdbool.h> (p: 332)
      • C11 standard (ISO/IEC 9899:2011):
      • 7.15 Alignment <stdalign.h> (p: 268)
      • 7.18 Boolean type and values <stdbool.h> (p: 287)
      • 7.19 Common definitions <stddef.h> (p: 288)
      • 7.23 _Noreturn <stdnoreturn.h> (p: 361)
      • 7.31.9 Boolean type and values <stdbool.h> (p: 456)
      • C99 standard (ISO/IEC 9899:1999):
      • 7.18 Boolean type and values <stdbool.h> (p: 253)
      • 7.19 Common definitions <stddef.h> (p: 254)
      • 7.26.7 Boolean type and values <stdbool.h> (p: 401)
      • C89/C90 standard (ISO/IEC 9899:1990):
      • 4.1.5 Common definitions <stddef.h>

      [edit]See also

      C++ documentation forType support library
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/types&oldid=180056"

      [8]ページ先頭

      ©2009-2025 Movatter.jp