Bijo
08-07-2013, 10:08 PM
If my memory serves me well and if I am properly reminded of the preprocessor that I used with C/C++ long ago, then what I'm about to ask is probably not what's the case with {$define}. I will put it forth anyway :P
In the FPC Compiler Reference it says that this can be used to define a symbol. Also, in the FPC Programmer's Guide it says that "The directive {$DEFINE name} defines the symbol name. This symbol remains defined until the end of the current module (i.e. unit or program), or until a $UNDEF name directive is encountered."
Of course, I would think that therefore I could do something like this: it's possible to assign my own symbols for use in the language. For example, it is possible to choose ~ as a symbol for not, and that the compiler will actually know and treat ~ as not. This seems to be entailed by the description that I read.
For instance, maybe I could try something like
{$define ~ not}
or
{$define ~ = not}
or some such thing?
Of course, I tested it and it doesn't work. Is it at all even possible to do such a thing?
If {$define} is used for defining some sort of difficult formula, then how exactly should this thing be used? Can you give an example?
In the FPC Compiler Reference it says that this can be used to define a symbol. Also, in the FPC Programmer's Guide it says that "The directive {$DEFINE name} defines the symbol name. This symbol remains defined until the end of the current module (i.e. unit or program), or until a $UNDEF name directive is encountered."
Of course, I would think that therefore I could do something like this: it's possible to assign my own symbols for use in the language. For example, it is possible to choose ~ as a symbol for not, and that the compiler will actually know and treat ~ as not. This seems to be entailed by the description that I read.
For instance, maybe I could try something like
{$define ~ not}
or
{$define ~ = not}
or some such thing?
Of course, I tested it and it doesn't work. Is it at all even possible to do such a thing?
If {$define} is used for defining some sort of difficult formula, then how exactly should this thing be used? Can you give an example?