Compiler edit 822 language enhancement adds new shortcut operators:
VAR |= expr ! equivalent to VAR = VAR or (expr)
VAR &= expr ! equivalent to VAR = VAR and (expr)
Similar to the existing combo operations (+=,-=,*=,/=), these are just syntactic shortcuts to simplify common statements, in this case, those involving setting and clearing bits in a flags variable. For example:
To set specified bits:
FLAGS |= XTF_MODELESS ! FLAGS = FLAGS or XTF_MODELESS
FLAGS |= XTF_LEFT or XTF_RIGHT ! FLAGS = FLAGS or (XTF_LEFT or XTF_RIGHT)
To clear all but specified bits:
FLAGS &= XTF_MODELESS ! FLAGS = FLAGS and XTF_MODELESS
To clear specified bits:
FLAGS &= NOT XTF_MODELESS ! FLAGS = FLAGS and not XTF_MODELESS
Notes:
• As with the other combo operations, these are transplants from the C language.
• When setting / clearing bits in a flags variable, it is almost always better to use the bitwise operators (AND,OR) instead of the arithmetic operators (+-), since the former are idempotent (i.e. can be used redundantly without changing the result).
• This is purely a compiler enhancement and has no effect on runtime compatibility for the compiled programs. So you may want to use this version of the compiler even if continuing to use the 6.4 runtime.