Delphi 7 to Delphi XE4 Code Migration Issues, Error, Warning and Hints
When I was migrating my old Delphi 7 code to new Delphi XE4, I got a lot code migration issues, errors, warning and hints. I resolved all the errors, warnings and hints by putting a lot of efforts. By this post, I want to share my experience of Delphi code migration. I had mentioned the list of errors which I got during migrating my code from Delphi 7 to Delphi XE4 in my last post. In this post, I will mention the list of compiler warning and hints which I got and resolved during Delphi 7 to Delphi XE4 code migration. Here is my list of compiler warning and hints:
1. Symbol is specific to platform
Some symbols work only in Windows platform but not on Linux, Mac etc. If your application is specific to windows platform only, you need not to consider this compiler warning.
2. Symbol is deprecated
If you get "Symbol is deprecated" compiler warning while migration the old delphi code to the newer versions of Delphi, you need to replace the methods with the newer versions.
3. Redeclaration hides a member in the base class
This compiler warning comes when base class variables are re-declared in derived class due to which base class variables become hidden.
4. Method hides virtual method of base type
This compiler warning comes when base class methods are re-declared in derived class due to which base class methods become hidden.
5. Constructing instance of 'TMyClass' containing abstract method
This compiler warning comes when abstract methods are defined in the class. So when object of such class is created, compiler throws this warning.
6. Return value of function might be undefined
This compiler warning comes when return value is assigned under some conditions in functions. If conditions are met, only then function returns the value otherwise return value remains undefined.
7. Variable might not have been initialized
This compiler warning comes when variables are assigned conditionally in a function or procedure. If condition is not met, variables remain uninitialized.
8. FOR-Loop variable may be undefined after loop
Variable is declared before FOR loop and used after FOR loop. Compiler throws warning because there might be some scenario when variable is not initialized within the FOR loop.
9. WideChar reduced to byte char in set expressions
Use CharInSet function to resolve the warning.
10. Private symbol declared but never used
This compiler hint comes when function is declared and implemented in the unit but not called within the unit.
11. Inline function has not been expanded because unit 'System.Types' is not specified in USES list
You will get this hint while migrating the old delphi code to the newer versions of Delphi. Add System.Types in uses and hint will get resolved.
No comments:
Post a Comment