R
red floyd
LeTubs said:Hi All
I'm just checking if my assumptions are correct
If I have the following line
#define CLIENT_MSG_HELLO 9
I know the define will be stored in a memory location, but
what will it be stored as ie short, int, unisigned int ?
Are there any general rules or is it platform/OS dependant?
Thanks
David
Your assumptions are incorrect. The define is textually substituted
into the source. There is no storage allocated for it except as
defined by usage context.
e.g.
int x = CLIENT_MSG_HELLO; // an int named x is allocated and initialized
with 9
x = x + CLIENT_MSG_HELLO; // no storage allocated, 9 is added to x
x = f(CLIENT_MSG_HELL0); // the literal 9 is passed to the function f.