Q:

#define negative numbers?

Simple question, but I cannot seem to find the answer. Is it okay to use #define to define a negative number, as in:
#define kGravity -9.8

XCode is changing the 9.8 to the color of my numbers I have set (purple), but the - is being shown as the same color as the define statement (orange).
Is this legal? Will it compile?

A:

Did you try it? It should work fine.
However, I would encourage you to not use pre-processor macros, but instead use real constants.
static const float kGravity = -9.8f;

Preprocessor directives are a bit frowned upon, in general. Here's some more info on the subject: #define vs const in Objective-C

A:

It is absolutely legal to define negative constants with #define. What you discovered is most likely a bug in Xcode's code coloring, which will probably be fixed in one of the future revisions.

