GBDK libraries documentation | ||
---|---|---|
Prev | Chapter 2. The Gameboy as a Target | Next |
The size of the various types as at 2.0b13 are:
char eight bit signed
unsigned char eight bit unsigned
int eight bit signed
unsigned int eight bit unsigned
long sixteen bit signed
unsigned long sixteen bit unsigned
long long 32 bit signed
unsigned long long 32 bit unsigned
float 8 bit exponent, 24 bit mantissa
pointer two byte
lcc uses 'int' as the default type for most operations including array indexing and constants. To make the code more efficient the ints were made eight bit which unfortunately limits local arrays to less than 128 elements. Note that statically allocated arrays such as image or tile data dont have this limitation.
To make it easier for porting and if/when the size of an int gets changed, it is recommended that the types BYTE, UBYTE, WORD and UWORD defined in type.h are used.
Prev | Home | Next |
The Gameboy as a Target | Up | Avoiding Promotion |