Data types
From Pinguino-Wiki
Supported data-types are (from SDCC Manual):
| type | width | default | signed range | unsigned range |
|---|---|---|---|---|
| bool | 1 bit | unsigned | - | 0, 1 |
| char | 8 bits, 1 byte | signed | -128 to +127 | 0 to +255 |
| short | 16 bits, 2 bytes | signed | -32,768 to +32,767 | 0 to +65,535 |
| int | 16 bits, 2 bytes | signed | -32,768 to +32,767 | 0 to +65,535 |
| long | 32 bits, 4 bytes | signed | -2,147,483,648 to +2,147,483,647 | 0 to +4,294,967,295 |
| float | 4 bytes IEEE 754 | signed | 1.175494351E-38 to 3.402823466E+38 | |
| pointer | 1, 2, 3 or 4 bytes | generic |
Pinguino also includes the following easy to remember integer data types :
| data type | width | signed/ unsigned | range |
|---|---|---|---|
| s8 | 8 bits (1 byte) | signed | -128 to +127 |
| s16 | 16 bits (2 bytes) | signed | -32,768 to +32,767 |
| s32 | 32 bits (4 bytes) | signed | -2,147,483,648 to +2,147,483,647 |
| s64 | 64 bits (8 bytes) | signed | −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
| u8 | 8 bits (1 byte) | unsigned | 0 to +255 |
| u16 | 16 bits (2 bytes) | unsigned | 0 to +65,535 |
| u32 | 32 bits (4 bytes) | unsigned | 0 to +4,294,967,295 |
| u64 | 64 bits (8 bytes) | unsigned | 0 to +18,446,744,073,709,551,615 |
8-bit Pinguinos use SDCC which is sometimes more strict than GCC which is used by the 32-bit Pinguinos.
You must define the type of variables first and then give them a value.
So for 8-bit pinguinos, using SDCC:
| ok for p8 , p32 | also works | wrong for p8 |
|---|---|---|
| BOOL a; u8 b; | BOOL a = FALSE; u8 b; | BOOL a; a = FALSE; |

