名前空間
変種
操作

Fundamental types

提供: cppreference.com
< cpp‎ | language


 
 
C + +言語
一般的なトピック
Original:
General topics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
フロー制御
Original:
Flow control
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
条件付き実行文
Original:
Conditional execution statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
繰り返し文
Original:
Iteration statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
文をジャンプします
Original:
Jump statements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
関数の宣言
ラムダ関数の宣言
関数テンプレート
の歴史。インライン指定
例外仕様 (廃止予定)
noexcept指定子 (C++11)
例外
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
名前空間
Original:
Namespaces
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
基本的なタイプ
複合型
列挙型
decltype specifier (C++11)
指定子
Original:
Specifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
CV指定
貯蔵期間指定
constexprの指定子 (C++11)
自動指定 (C++11)
alignas指定子 (C++11)
初期化
Original:
Initialization
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
リテラル
Original:
Literals
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
Expressions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
代替表現
ユーティリティ
Original:
Utilities
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
タイプ
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
typedef declaration
型の別名宣言 (C++11)
属性 (C++11)
キャストします
Original:
Casts
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
暗黙の型変換
const_cast conversion
static_cast conversion
dynamic_cast conversion
reinterpret_cast conversion
Cスタイルキャストと機能
メモリの割り当て
Original:
Memory allocation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
クラス
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
クラス固有の機能特性
Original:
Class-specific function properties
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
明示 (C++11)
静的
特殊なメンバ関数
Original:
Special member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
テンプレート
Original:
Templates
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
クラステンプレート
関数テンプレート
テンプレートの特殊化
パラメーターパック (C++11)
その他
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
インラインアセンブリ
 

(Also see the list of type-related utilities that are provided by C++.)

目次

[編集] Boolean type

bool - type, capable of holding one of the two values: true or false.

[編集] Character types

signed char - type for signed character representation.
unsigned char - type for unsigned character representation.
char - type for character representation which can be most efficiently processed on the target system (equivalent to either signed char or unsigned char).
wchar_t - type for wide character representation
char16_t - type for UTF-16 character representation (C++11およびそれ以降)
char32_t - type for UTF-32 character representation (C++11およびそれ以降)

[編集] Integer types

int - basic integer type. Can be omitted if any of the modifiers are present. If no length modifiers are present, guaranteed to have width of at least 16 bits. However, on 32/64 bit systems it is almost exclusively guaranteed to have width of at least 32 bits (see below).

[編集] 修飾子

Modifies the integer type. Can be mixed in any order. Only one of each group can be present in type definition.

Signedness

signed - target type will have signed representation (this is the default if omitted)
unsigned - target type will have unsigned representation

Size

short - target type will be optimized for space and will have width of at least 16 bits.
long - target type will have width of at least 32 bits.
long long - target type will have width of at least 64 bits (C++11およびそれ以降)

[編集] Properties

The following table summarizes all available integer types and their properties:

Type specifier Equivalent type Width in bits by data model
C++ standard LP32 ILP32 LLP64 LP64
short
short int at least
16
16 16 16 16
short int
signed short
signed short int
unsigned short
unsigned short int
unsigned short int
int
int at least
16
16 32 32 32
signed
signed int
unsigned
unsigned int
unsigned int
long
long int at least
32
32 32 32 64
long int
signed long
signed long int
unsigned long
unsigned long int
unsigned long int
long long
long long int
(C++11)
at least
64
64 64 64 64
long long int
signed long long
signed long long int
unsigned long long
unsigned long long int
(C++11)
unsigned long long int

Note: the C++ Standard guarantees that 1 == sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long).

[編集] Data models

32 bit systems:

  • LP32:
  • Win16 API
  • ILP32;
  • Win32 API
  • Unix and Unix-like systems (Linux, Mac OS X)

64 bit systems:

  • LLP64
  • Win64 API
  • LP64
  • Unix and Unix-like systems (Linux, Mac OS X)

[編集] Floating point types

float - single precision floating point type. Usually IEEE-754 32 bit floating point type
double - double precision floating point type. Usually IEEE-754 64 bit floating point type
long double - extended precision floating point type. Does not necessarily map to types mandated by IEEE-754. Usually 80-bit x87 floating point type on x86 and x86-64 architectures.

[編集] Range of values

The following table provides a reference for limits of common numeric representations. Note, that all popular data models (including all of ILP32, LP32, LP64, LLP64) use two's complement arithmetic. Also, the C++ Standard does not specify which arithmetic would be used, thus it guarantees only the limits of one's complement arithmetic.

Type Size in bits Format Value range
Approximate Exact
character 8 signed (one's complement) -127 to 127
signed (two's complement) -128 to 127
unsigned 0 to 255
integral 16 signed (one's complement) ± 3.27 · 104 -32767 to 32767
signed (two's complement) -32768 to 32767
unsigned 0 to 6.55 · 104 0 to 65535
32 signed (one's complement) ± 2.14 · 109 -2,147,483,647 to 2,147,483,647
signed (two's complement) -2,147,483,648 to 2,147,483,647
unsigned 0 to 4.29 · 109 0 to 4,294,967,295
64 signed (one's complement) ± 9.22 · 1018 -9,223,372,036,854,775,807 to 9,223,372,036,854,775,807
signed (two's complement) -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned 0 to 1.84 · 1019 0 to 18,446,744,073,709,551,615
floating
point
32 IEEE-754 ± 3.4 · 10± 38
(~7 digits)
  • min subnormal: ± 1.401,298,4 · 10-47
  • min normal: ± 1.175,494,3 · 10-38
  • max: ± 3.402,823,4 · 1038
64 IEEE-754 ± 1.7 · 10± 308
(~15 digits)
  • min subnormal: ± 4.940,656,458,412 · 10-324
  • min normal: ± 2.225,073,858,507,201,4 · 10-308
  • max: ± 1.797,693,134,862,315,7 · 10308

[編集] キーワード

bool, true, false, char, wchar_t, char16_t, char32_t, int, short, long, signed, unsigned, float, double

[編集] も参照してください