Types ===== Type compatibility ------------------ When LRL checks type compatibility, it will first check if both types have a name (and neither type is an alias). If so, the types are considered equal only if the names match. Otherwise, the structure of the types will be compared (e.g. it will be possible to assign an "int" to a "long", or two equals structs to each other). **TODO** Test aliases more thorougly **NOTE** should not be allowed to "cast" pointers from one named type to another through an unnamed structurally compatible type. perhaps change the rules to allow only casts of pointers in one direction? or not at all? Type qualifiers --------------- **TODO** Identifier types ---------------- **TODO** Builtin types ------------- There are several numeric types and a bool type. **NOTE** explain kinds of types, wrap around, etc. special types byte/uint8, eint, wuint/uint compatibility... **NOTE** short<=int<=long<=longlong **NOTE** float<=double etc. **NOTE** should byte be compatible with eint8? **NOTE** floating point formats have an implied bit in the coefficient
Name | Kind | Signed? | Wraps? | Min Bits | Max Bits |
---|---|---|---|---|---|
count | Integer - word-sized | 16 | ∞ | ||
wcount | Integer - word-sized | Yes | 16 | ∞ | |
uint | Integer - system size | 16 | ∞ | ||
wuint | Integer - system size | 16 | ∞ | ||
int | Integer - system size | Yes | 15+1 | ∞ | |
eint | Integer - system size | 15+1 | ∞ | ||
ushort | Integer - system size | 16 | ∞ | ||
wushort | Integer - system size | 16 | ∞ | ||
short | Integer - system size | Yes | 15+1 | ∞ | |
eshort | Integer - system size | 15+1 | ∞ | ||
ulong | Integer - system size | 32 | ∞ | ||
wulong | Integer - system size | 32 | ∞ | ||
long | Integer - system size | Yes | 31+1 | ∞ | |
elong | Integer - system size | 31+1 | ∞ | ||
ulonglong | Integer - system size | 64 | ∞ | ||
wulonglong | Integer - system size | 64 | ∞ | ||
longlong | Integer - system size | Yes | 63+1 | ∞ | |
elonglong | Integer - system size | 63+1 | ∞ | ||
byte | Integer - fixed size | 8 | 8 | ||
char | Integer - fixed size | 8 | 8 | ||
uint8 | Integer - fixed size | 8 | 8 | ||
wuint8 | Integer - fixed size | Yes | 8 | 8 | |
int8 | Integer - fixed size | Yes | 7+1 | 7+1 | |
eint8 | Integer - fixed size | 7+1 | 7+1 | ||
uint16 | Integer - fixed size | 16 | 16 | ||
wuint16 | Integer - fixed size | Yes | 16 | 16 | |
int16 | Integer - fixed size | Yes | 15+1 | 15+1 | |
eint16 | Integer - fixed size | 15+1 | 15+1 | ||
uint32 | Integer - fixed size | 32 | 32 | ||
wuint32 | Integer - fixed size | Yes | 32 | 32 | |
int32 | Integer - fixed size | Yes | 31+1 | 31+1 | |
eint32 | Integer - fixed size | 31+1 | 31+1 | ||
uint64 | Integer - fixed size | 64 | 64 | ||
wuint64 | Integer - fixed size | Yes | 64 | 64 | |
int64 | Integer - fixed size | Yes | 63+1 | 63+1 | |
eint64 | Integer - fixed size | 63+1 | 63+1 | ||
uint128 | Integer - fixed size | 128 | 128 | ||
wuint128 | Integer - fixed size | Yes | 128 | 128 | |
int128 | Integer - fixed size | Yes | 127+1 | 127+1 | |
eint128 | Integer - fixed size | 127+1 | 127+1 | ||
float | Floating point - system size | Yes | 32(1+23+8) | ∞ | |
float16 | Floating point - fixed size | Yes | 16(1+10+5) | 16 | |
float32 | Floating point - fixed size | Yes | 32(1+23+8) | 32 | |
float64 | Floating point - fixed size | Yes | 64(1+52+11) | 64 | |
float80 | Floating point - fixed size | Yes | 80(1+63+16) | 80 | |
float128 | Floating point - fixed size | Yes | 128(1+112+15) | 128 | |
cfloat | Floating point - system size | Yes | 32(1+23+8) | ∞ | |
cdouble | Floating point - system size | Yes | 64(1+52+11) | ∞ | |
clongdouble | Floating point - system size | Yes | 64(1+52+11) | ∞ | |
bool | Boolean | 1+15 | ∞ |