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. Use the preincrement and predecrement operators

10. Use constants to access absolute memory locations

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

12. When using the ternary operator, cast values that are not ints

13. Use the array operator [] even for pointers

14. Use register variables with care

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

16. Access to parameters in variadic functions is expensive


Next Previous Contents