Upgrading to VCL Compiler 1.1

Overview

The new compiler has a number of new features for the VCL programmer:

  • Support for constants larger than 15-bits, including in bit aliases.
  • Faster compile times.
  • Better error reporting.
  • Debug table with VCL Program Counter -> Source Code Line number for determining the location of Vcl Runtime Error's.
  • Consistent handling of complex constructs like function calls in if statements.
  • Support for escape sequences in string constants: “This is a string\nWith a newline”
  • Automatic string constant re-use.
  • Automatic constant folding.

Selecting a Compiler Version

The compiler version can be selected using the gear    icon in the VCL Studio toolbar next to the compile button.

In addition, when opening an old project for the first time in CIT 1.5.1 or later, you will be prompted to upgrade to the new compiler.

Note that CIT 2.0 will only support VCL Compiler 1.1.

Migration Advice

Constants

Due to the limitations of the old compiler, especially around constants, it’s recommended that VCL programmers move their projects to the new compiler as soon as possible.

However, they should be aware that the behavior of their programs could change. Consider the following code snippet:

create Bit0 bit user0.1 create Bit15 bit user1.32768 user0 = 1 << 0 user1 = 1 << 15 failed equals user2 failed = 0 if (Bit0 = Off) { failed = 1 } if (Bit15 = Off) { failed = 1 }

With the old compiler, the above snippet will end with failed = 1 from the second check. In the new compiler, failed will be set to 0. While the latter is the desired behavior, you might be inadvertently benefiting from the incorrect compiler behavior in your particular application.

Because of this, you should carefully review your program for errors. Recent versions of VCL Studio have been able to detect most errors related to large constants with the old compilers but the following were not detected:

  • Errors in included files (e.g. include "/projects/my_customer/common.vcl)
  • Large constants in bit aliases (e.g. create Bit15 bit user1.32768)

Starting with CIT 1.5.1, if you compile your program with the 1.0 compiler, VCL Studio will now detect large constant errors in included files. However, it will still not detect errors in bit aliases. When upgrading, we recommend at a minimum searching your program for .32768 and considering the effect of the behavior change.

Additionally, you can utilize the attached VCL file to experiment with bit alias behavior in both compilers.

Include Paths

With VCL Compiler 1.0, include paths like "\Users\someUser\Documents\someFile.vcl" were allowed. Because C-style escape sequences are now permissible (like "\n"), these paths need to be changed in one of the following ways:

  • "/Users/someUser/Documents/someFile.vcl"
  • "\\Users\\someUser\\Documents\\someFile.vcl"
Attached Files
BitOperationsTest.vcl
404kb