Types and variables
Gentee is a strongly-typed language that is why types occupy a very important place in programming in Gentee. All types can be divided into three groups: numeric types, structural types and the reserved type.
Numeric types
All numeric types are built into the language. uint is the most widespread numeric type. The Gentee language has neither pointers nor logic type, the uint performs their functions. The byte, ubyte, short, ushort types are considered as int or uint types (depending on the sign) when arithmetic operations are performed. If you specify them as fields in structural types, they will occupy the corresponding number of bytes.
Type name | Size of type | Minimum | Maximum | Comments |
Integer types | ||||
byte | 1(4) | -128 | +127 | signed |
ubyte | 1(4) | 0 | +255 | unsigned |
short | 2(4) | -32768 | +32767 | signed |
ushort | 2(4) | 0 | +65535 | unsigned |
int | 4 | -2147483648 | +2147483647 | signed |
uint | 4 | 0 | +4294967295 | unsigned |
long | 8 | -2^63 | +2^63 - 1 | signed |
ulong | 8 | 0 | +2^64 - 1 | unsigned |
Floating types | ||||
float | 4 | (+ or -)10E-37 | (+ or -)10E38 | ; |
double | 8 | (+ or -)10E-307 | (+ or -)10E308 |
Structure types
Structure types are defined by the type command. Types string ( str), binary data (buf), collection (collection) are embedded into the language. A lot of types are defined in the standard and other libraries (arrays, hashes etc).
Type reserved
The reserved type is of special significance, which belongs neither to the fundamental types nor to the structure ones. This type is denoted by the array of bytes, which is defined and used as the array. The distinctive feature of the reserved type is that, the memory space is reserved where it has been defined. For example, you can specify a field in a structure reserved field[50]. This means that a memory space of 50 bytes will be reserved in the structure. If you specify the same code inside a function then you reserve 50 bytes in the stack for this local variable. The size of memory reservation allows up to 65 535 bytes. Bear in mind that you should not use an expression in order to specify the required size. It is a constant number that must be enclosed in square brackets.