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,230 other followers

Bogus W1036 ? 

Posted by jpluimers on 2020/07/30

Reminder to self for checking if this still fails:

[WayBack] Bogus W1036 ? Documentation: … “If you do not explicitly initialize a global variab… – Stefan Glienke – Google+


“If you do not explicitly initialize a global variable, the compiler initializes it to 0.”


  i: Integer;


[DCC Warning] Project1.dpr(6): W1036 Variable 'i' might not have been initialized


2 Responses to “Bogus W1036 ? ”

  1. abouchez said

    Yes. All global variables are allocated at once when the exe is loaded, as a whole private in-memory section, and filled by the Operating System executable loader with zeros.

    This warning is indeed paranoid, and only affect the dpr (not the units).
    In fact, this is a compiler optimization. This variable i is not identified as a global variable, but a local variable – typically it could be used in a loop.
    Usually, I never put any loop and such in the main begin…end block of the dpr. I try to always use an explicit sub-function.

    So this is not a bug, this is a feature, from the compiler point of view.

    • Stefan Glienke said

      I cannot count how often I had weird issues with all kinds of things just because I thought that just quickly testing something in the dpr main was a good idea.

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: