The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,482 other followers

E2026 or W1023 – take your pick (:

Posted by jpluimers on 2018/08/08

[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)}

// This not:
{$IF Declared(Test)}
{$IF Test>=100} // "E2026 Constant expression expected"

The W1023 can be alleviated by replacing 100 with +100.

Note that both errors have been documented since at least Delphi 2007:


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

2 Responses to “E2026 or W1023 – take your pick (:”

  1. cesarliws said

    Different from the working declaration, the erroneous one is lacking the parentheses, I’m wondering if it can work.

    {$IF (Test>=100)}

    PS: I do not have Delphi here at my work to test it right now.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: