Show Menu
Cheatography

D Language Cheatsheet Cheat Sheet (DRAFT) by

Sample cheatsheet for the D Programming Language

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Main function

int main(string []args){
  // return isn't necessary
}

Default type properties

.init
Default type initia­lizer
.sizeof
size in bytes
.alignof
alignment size
.mangleof
string repres­ent­ating of "­man­gle­d" repres­ent­ation of type
.stringof
string repres­enting of source repres­ent­ation of type

Symbolic data types

Type
Size
Descri­ption
char
1 byte
UTF-8 char
wchar
2 bytes
UTF-16 char
dchar
4 byte
UTF-32 char

Integer data types

Type
Size
Descri­ption
bool
1 byte
True or False
byte
1byte
-128 to 127
ubyte
1byte
0 to 255
short
2 bytes
-32,768 to 32,767
ushort
2 bytes
0 to 65,535
int
4 bytes
-2,147­,48­3,648 to 2,147,­483,647
uint
4 bytes
0 to 4,294,­967,295
long
8 bytes
-92233­720­368­547­75808 to 922337­203­685­4775807
ulong
8 bytes
0 to 184467­440­737­095­51615

Integral type properties

.min
Minimum value of type
.max
Maximum value of type
 

Float data types

Type
Size
Descri­ption
float
4 bytes
1.1754­9e-38 to 3.4028­2e+38
ifloat
4 bytes
1.1754­9e-38i to 3.4028­2e+38i
double
8 bytes
2.2250­7e-308 to 1.7976­9e+308
idouble
8 bytes
2.2250­7e-308i to 1.7976­9e+308i
real
10 bytes
3.3621­e-4932 to 1.1897­3e+4932
ireal
10 bytes
3.3621­e-4932i to 1.1897­3e+­4932i
cfloat
8 bytes
1.1754­9e-­38+­1.1­754­9e-38i to 3.4028­2e+­38+­3.4­028­2e+38i
cdouble
16 bytes
2.2250­7e-­308­+2.2­25­07e­-308i to 1.7976­9e+­308­+1.7­97­69e­+308i
creal
20 bytes
3.3621­e-4­932­+3.3­62­1e-­4932i to 1.1897­3e+­493­2+1.18­973­e+4932i

Float type properties

.nan
Not A Number value
.infinity
Infinity value
.dig
Number of decimal digits in precision
.min
Minimum value of type
.max
Maximum value of type
.re
Real part of type
.im
Imagine part of type
.epsilon
smallest increment to value 1