Search code examples
variablesdelphicompiler-errorsdelphi-7forcing

Forcing Compilation Error - Variable might not have been initialized in Delphi 7


well, I work on developing a software that is still compiled in Delphi 7, and our team got some errors that were caused by variable that wasn't initialized. So we decided to force a compilation error if the Delphi 7 finds a variable like this, to avoid future errors.

But, the problem is that I didn't found any option about it in Delphi 7, I know that Delphi XE or later has this option.

Do you know some plugin or anything else that can help me on it? It can be some to force a compilation error or find all variable that wasn't initialized on the Project.


Solution

  • i dont have a Delphi 7 at hand. I hope the Directives from the Link work.

    So, if your having anly a few Warnings you should enable "Treat warnings as error". (i dont know where that in d7 is, but i believe even d5 had this)

    Option Error as Warning Delphi 2009 where is the 'treat warnings as errors' option?

    Hidden Error/Warning Options https://marc.durdin.net/2012/05/delphi-xe2s-hidden-hints-and-warnings-options/

    (untested: Perhaps you can even define except Warnings in d7. For XE see Tools-Debugger Options-Embarcadero Debuggers-Language Exceptions)