Migrating to DataFlex 2021 Part 1
Lesson 5: Using the warning system to make corrections for DataFlex 2021
This lesson will focus on how to use the complier warning system to help solve possible problems. In DataFlex 2021, the warning system has been extended to help developers make corrections. This is largely because DataFlex has become fully Unicode and the Dataflex string is now UTF-8 encoded.
Most Unicode related warnings are important to look into because the code in question could really cause incorrect behavior or even crashes There are several types of warnings:
- Obsolete command
- String commands vs. String functions
- Obsolete keywords
- Obsolete use of the Type structures
- Warnings about conversions between string and pointer
- Functions that are not Unicode safe
There can be a lot of warnings and not all of them are important for getting an application working well. To make it easier to focus on what’s important, filter the warnings by using the CompilerLevelWarning command.
- In this large sample workspace, there is a lot of old code and the use of a lot of obsolete commands, keywords, etc. Running the compiler results in over 3,000 warnings.
- The complete compiler warning system can be turned on or off. To do this, select ‘Projec’t from the Menu, then ‘Project properties.’ On the General tab page there is an option to suppress all compiler warnings that will indeed hide all of the warnings.
- Supposing that the goal is to prepare the application for running in DataFlex 2021, the warnings need to be filtered to only show what is relevant. In other words, they need to be filtered to only show Unicode related warnings.
- The command, CompilerLevelWarning, can be used after including the Dfallent.pkg. By default all warnings are on. Adding this code and compiling reduces the number of warnings from over 3,000 to 441. Most of them are about the TYPE structure. Each will need to be reviewed and changed to STRUCTs.