__int8、 __int16、 __int32、 __int64

Microsoft 固有の仕様 →

サイズが設定された整数型の Microsoft C/C++ の機能のサポート。n は 81632または 64 である __intn の 型指定子を使用して 816 ビット32 ビットまたは 64 ビット整数変数は宣言できます。

次の例ではサイズのサイズの整数の型の 1 種類の変数を宣言しています :

__int8 nSmall;      // Declares 8-bit integer
__int16 nMedium;    // Declares 16-bit integer
__int32 nLarge;     // Declares 32-bit integer
__int64 nHuge;      // Declares 64-bit integer

型 __int8__int16 と __int32 は同じサイズになりますが複数のプラットフォームでまったく同じように動作する移植性のあるコードを作成する場合に便利です。ANSI の型のシノニムです。__int8 のデータ型は char と同じ意味です __int16 は型 短い名前 と同じ意味です __int32 は型 int と同じ意味です。__int64 の型に ANSI 機能がありません。

使用例

次の例では __intxx のパラメーターが int に昇格されたことを示します :

// sized_int_types.cpp

#include <stdio.h>

void func(int i) {
    printf_s("%s\n", __FUNCTION__);
}

int main()
{
    __int8 i8 = 100;
    func(i8);   // no void func(__int8 i8) function
                // __int8 will be promoted to int
}
  

参照

関連項目

C++ のキーワード

基本を入力します (C++)

データ型の範囲