* 型 [#ya683311] #contents * 基本型 [#j6c7452f] |予約語|説明|サイズ(byte)|初期値|h |void|型なし|-|-| |bool|ブール値|実行環境で変わる|false| |byte &br;ubyte &br;uint8 &br;u8|符号無し8bit整数|1|0| |sbyte&br;sint8 &br;s8|符号有り8bit整数|1|0| |short&br;sshort &br;sint16 &br;s16|符号有り16bit整数|2|0| |ushort&br;uint16 &br;u16|符号無し16bit整数|2|0| |int &br;sint &br;sint32 &br;s32|符号有り32bit整数|4|0| |uint &br;uint32 &br;u32|符号無し32bit整数|4|0| |long&br;slong &br;sint64 &br;s64|符号有り64bit整数|8|0| |ulong &br;uint64 &br;u64|符号無し64bit整数|8|0| |float &br;float32 &br;f32|32bit浮動小数点数|4|0| |double &br;float64 &br;f64|64bit浮動小数点数|8|0| |char|8bit文字列(UTF-8)|1|0x00| |wchar|16bit文字列(UTF-16)|2|0x0000| |dchar|32bit文字列(UTF-32)|4|0x000000000| |object|ガベージコレクト対象のオブジェクトの参照&br;(class の基底クラス)|実行環境で変わる|null| |pointer|非ガベージコレクト対象のデータのポインタ|実行環境で変わる|null| * 構造データ型 [#b89256ff] - 配列 - %%連想配列%% - %%デリゲート%% * ユーザー定義型 [#ed8f1e9c] - class - enum - interface - struct - pod - utility * object [#obb7d0e0] - ガベージコレクト対象の型。 #code(c,){{ class Sample { class Pos { int x; int y; }; static void Example() { Pos pos1 = new Pos(); // pos1にオブジェクトを割り当てる Pos pos2; // nullで初期化される pos2 = pos1; // pos2とpos1に指し示すオブジェクトが同じになる pos1.x = 2; // メンバのアクセスはpod,struct,classと同じようにアクセスできる // null チェックはこのように行う。D言語と同じ。 if ( pos2 is null ) {// null チェックはこのように行う。D言語と同じ。 { } // 同じかどうかもisを使う if ( pos1 is pos2 ) { } // !is は != のようなもの。 if ( pos1 !is null ) { } // 組み込み型,pod型,struct型はnewできない! int@ intVal = new int(); // エラー } }; }} * bool [#g23f0ec6] * 暗黙の変換 [#z9808145] * 算術計算の変換 [#gce6709e] * %%デリゲート%% [#c7ab2479] |