.define is a blunt instrument, much like #define. You can find some problems of #define from Google easily, although not all of them apply to ca65.
Example of a problem you might face:
Code:
.define MY_CONSTANT 123+456
.define ANOTHER_CONSTANT 2*MY_CONSTANT
; Oops, ANOTHER_CONSTANT is now 2*123+456 = 702
If you use proper symbols instead of .define you're fine:
Code:
MY_CONSTANT = 123+456
ANOTHER_CONSTANT = 2*MY_CONSTANT
; Fine, ANOTHER_CONSTANT is 2*(123+456) = 1158
...
Just as a sidenote, the following can't be used in ca65:
Code:
.define MY_CONSTANT (123+456)
The reason is that ca65 takes the opening paren to mean the start of the .define's parameter list. One possible fix is to do something like this:
Code:
.define MY_CONSTANT ~~(123+456)
Other than this quirk, adding those extra parens in the .define can be used to fix this specific problem, but really there's no point since you could've used symbols in the first place (so this is one case of "don't use .define unless you
have to").