In Delphi, you can define symbols, just like in C/C++.
Delphi:
{$DEFINE MY_SYMBOL}
C/C++:
#define MY_SYMBOL
This allows you to check whether the symbol is defined by using {$IFDEF MY_SYMBOL}
in Delphi, or #ifdef MY_SYMBOL
in C/C++.
This is a boolean value - either the symbol is defined during pre-processing or not. However, C/C++ also allows you to assign values to preprocessor symbols. E.g.:
#ifdef DEBUG
#define DB_HOST "127.0.0.1"
#else
#define DB_HOST "123.456.789.123"
#endif
Database *pDatabase = new Database(DB_HOST);
Is assigning a value to a preprocessor symbol possible in Delphi, or does Delphi only allow you to determine whether or not a symbol has been defined at all?
EDIT: As Delphi doesn't support symbol values in the preprocessor, I'm assuming it doesn't support preprocessor macros. Am I right in this assumption?
For example, in C you can define a preprocessor macro that gets copied and pasted with the appropriate parameters before compilation. This is useful when you want "inline function" capability for fast operations (e.g., binary logic, testing in an integer values, bit-shifting, etc) without the overhead of stack frames, parameter passing and the like.
#define OK_FLAG 0x00000001
#define OK(f) (f & OK_FLAG)
#define WEAK_XOR_CIPHER(v) (v ^ 0xff)