Quantcast
Channel: Delphi – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 1445

E2026 or W1023 – take your pick (:

$
0
0

[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:

–jeroen

Source: A compiler curiosity I’ve learned today: // This works: {$IF Declared(Test) …


Viewing all articles
Browse latest Browse all 1445

Trending Articles