types, not as we know them
Michal writes about his continuing pain with the Amiga
ULONG types on 64-bit AROS. Some guidelines for types:
- If you’re writing new code, just use the normal C types, and if you need types of a specific width, look to C99
uint32_t, etc. On AROS,
LONGis always 32 bits, even on 64 bit systems. The C type
long, however, can be 32 or 64 bits. Don’t assume they mean the same thing.
- Don’t use
IPTR, etc except when calling a system API that uses them, and then take care to make sure your type conversion is spot on.
- The possible exception to this is
BOOL, but only ever assign
FALSEto it, and never explicitly test its value; that is use
if (flag), not
if (flag == TRUE).
- Don’t store pointers in non-pointer types. If you want a generic pointer, use
void *. If you need to convert between an integral type and a pointer, use
- Don’t do clever bit things with bit fields, like Michal describes for
FHF_WRITE. Just say what you mean.
This community service announcement brought to you by the variables
foo in the hopes that it helps the general health and wellbeing of people like Michal who have to decipher yours and my bad code by themselves years after it was written :)