Defining Constants

PB/CC constants (also known as equates) are defined by prefixing the name of the constant with a "%" character.  MSBASIC and VB define constants with the CONST keyword.  The MSBASIC/VB compiler then does type conversions at the point of use, if the constant's type was not specified.  That overhead does not happen (and is not necessary) with PB/CC.  String equates are specified with a leading "$" character.

However, the MACRO facilities in PB/CC offer a way to retain the CONST syntax in your code, while maintaining the low overhead advantage of PowerBASIC.  For example:

MACRO CONST = MACRO

...

CONST Something = 1&

CONST Something_Else = 2???

CONST AppTitle = "My Application"

...

PRINT AppTitle, Something

During compilation, the CONST keyword is replaced by the MACRO word, which dynamically creates a new macro that, in turn, defines a constant.

 

See Also

Upgrading To PBCC

Graphics

Constants and Literals

Numeric Equates

Built-in numeric equates

String Equates

Built-in string equates