Comparative data types
ThinBASIC uses BASIC convention for data type naming, which is incompatible with most non-BASIC languages.
The following table will help you with matching the correct thinBASIC type with the correct type in the targetted language:
Data type | Meaning |
---|---|
INTEGER | 16 bit signed integer |
LONG | 32 bit signed integer |
QUAD | 64 bit signed integer |
BYTE | 8 bit unsigned integer |
WORD | 16 bit unsigned integer |
DWORD | 32 bit unsigned integer |
SINGLE | 32 bit floating point |
DOUBLE | 64 bit floating point |
EXTENDED | 80 bit floating point |
NUMBER | 80 bit floating point |
STRING | BSTR |
ASCIIZ | Null-terminated buffer of characters |
With this knowledge, you may translate thinBASIC UDT:
TYPE Point2D
x AS SINGLE
y AS SINGLE
END TYPE
...as the following in C:
struct Point2D {
float x;
float y;
};
...as the following in Rust:
#![allow(unused)] fn main() { struct Point2D { pub x: f32, pub y: f32, } }