Next Previous Contents

cc65 coding hints

Ullrich von Bassewitz, uz@cc65.org

03.12.2000


How to generate the most effective code with cc65.

1. Use prototypes

2. Don't declare auto variables in nested function blocks

3. Remember that the compiler does not optimize

4. Longs are slow!

5. Use unsigned types wherever possible

6. Use chars instead of ints if possible

7. Make the size of your array elements one of 1, 2, 4, 8

8. Expressions are evaluated from left to right

9. Case labels in a switch statments are checked in source order

10. Use the preincrement and predecrement operators

11. Use constants to access absolute memory locations

12. Use initialized local variables - but use it with care

13. When using the ?: operator, cast values that are not ints

14. Use the array operator [] even for pointers

15. Use register variables with care

16. Decimal constants greater than 0x7FFF are actually long ints


Next Previous Contents