[WayBack] A compiler curiosity I’ve learned today … – David Berneda – Google+: depending on if TEST is defined or not, you get E1026 or W1023.
// This works:
{$IF Declared(Test) and (Test>=100)}
{$ENDIF}
// This not:
{$IF Declared(Test)}
{$IF Test>=100} // "E2026 Constant expression expected"
{$ENDIF}
{$ENDIF}
The W1023 can be alleviated by replacing 100
with +100
.
Note that both errors have been documented since at least Delphi 2007:
- [WayBack] W1023: Comparing signed and unsigned types – widened both operands
- [WayBack] Constant expression expected (E2026)
–jeroen
Source: A compiler curiosity I’ve learned today: // This works: {$IF Declared(Test) …