Enables automatic recognition of variable name postfixes.
$AutoPost[fix][On|Off]
$NoAutoPost[fix]
$AutoPost enables - and $NoAutoPost disables - the automatic recognition of postfixes with variable names.
By default, GFA-BASIC 32 recognizes variables without a postfix after they are declared with a postfix (Local i% : i = 12). This is only possible when the name is used with one type; if the variable name is used for an integer it cannot then be used for a string at the same time.
$AutoPost is synonymous with $AutoPostOn, $AutoPostfix and $AutoPostfixOn
$NoAutoPost is synonymous with $NoAutoPostfix, $AutoPostOff and $AutoPostfixOff
Dim a$
$AutoPostOn ' Postfix recognition enabled
a = "GFA" ' a is recognised as a$
$NoAutoPost ' Disable postfix recognition
a = "GFA" ' Does not compile - IDE Error: "Variable a?"
The default setting differs from the default behaviour of GFA-BASIC for Windows 16-bit. In the 16-bit version, a name could be used many times, but each occurence would still be different because of the use of a postfix (Local i%, i$). When a 16-bit program is ported to 32-bit the compiler might be instructed to use the postfix to differentiate between the variables. To make sure that the variables are used with a postfix explicitly use $NoAutoPost.
In addition, $NoAutoPost only works when variables are declared with a postfix; if a variable is declared using the Dim variable As vartype format, it is unaffected by the $AutoPost settings and takes precedence over any variables declared using a postfix as shown in the example below:
Dim a& = 3, a% = 4, a As Int32
$AutoPost
a = 5 // Assigns value to a not a& or a%
$NoAutoPost
a = 7 // Again assigns value to a not a& or a%
Print a&, a%, a // Prints 3 4 7
$ObjCheck or $Obj re-enables auto post recognition as well.
{Created by Sjouke Hamstra; Last updated: 23/06/2015 by James Gaite}