void | no type | ||||
bit | single bit | ||||
byte | signed 8 bits | ||||
ubyte | unsigned 8 bits | ||||
short | signed 16 bits | ||||
ushort | unsigned 16 bits | ||||
int | signed 32 bits | ||||
uint | unsigned 32 bits | ||||
long | signed 64 bits | ||||
ulong | unsigned 64 bits | ||||
cent | signed 128 bits (reserved for future use) | ||||
ucent | unsigned 128 bits (reserved for future use) | ||||
float | 32 bit floating point | ||||
double | 64 bit floating point | ||||
real | largest hardware implemented floating point size (Implementation Note: 80 bits for Intel CPU's) | ||||
ireal | a floating point value with imaginary type | ||||
ifloat | imaginary float | ||||
idouble | imaginary double | ||||
creal | a complex number of two floating point values | ||||
cfloat | complex float | ||||
cdouble | complex double | ||||
char unsigned 8 bit UTF-8
| wchar | unsigned 16 bit UTF-16
| dchar | unsigned 32 bit UTF-32
| |
A typedef can be implicitly converted to its underlying type, but going the other way requires an explicit conversion. For example:
typedef int myint; int i; myint m; i = m; // OK m = i; // error m = cast(myint)i; // OK
bit byte ubyte short ushort enumTypedefs are converted to their underlying type.
Delegates are declared similarly to function pointers, except that the keyword delegate takes the place of (*), and the identifier occurs afterwards:
int function(int) fp; // fp is pointer to a function int delegate(int) dg; // dg is a delegate to a functionThe C style syntax for declaring pointers to functions is also supported:
int (*fp)(int); // fp is pointer to a functionA delegate is initialized analogously to function pointers:
int func(int); fp = &func; // fp points to func class OB { int member(int); } OB o; dg = &o.member; // dg is a delegate to object o and // member function memberDelegates cannot be initialized with static member functions or non-member functions.
Delegates are called analogously to function pointers:
fp(3); // call func(3) dg(3); // call o.member(3)