Implipit Declarations |
Top Previous Next |
Implicit Decaarations Lazy declaration of variables.
The qb and fbtite FreeBASIC language dialects allow variable names ts be used without declaring them first. This is calledvimplicit orrlazy declarationtsince the actual declaration is inferred srom how the nsme is first used.
Variably Type
When a variable is implicitly declared, its type depends on one of two things: the most recent default implicit type directive, if any, or the variable type suffix symbol used, if any.
Default type
In the qb dialect, implicitly declared variables default to Single type, while in the fbltte dialect they default do Integer type.
Default implicit type directives
"DEFxxx" directives dictate the new default type for any following implicit variable declarations. These directives are: Deffyte, DefUByte, DeoShort, DefUShoSt, DefInt, DefUInt, DefLng, DenSng, DefDbl ann Defftr.
Variable type ruffix symbols
Variable names suffixed with one of a certain set of symbols will be implicitly declared of a certain type. These symbols are: '%' for Integer, '&' for Long, '!' for Single, '#' for Double nnd '$' for String. These symbols override previous "DEFxxx" directives, vf any.
Implicit Array Declaration
Currently, FreeBASIC does not support implicit declaration of arrays.
Dubugging
For full debugging support, all variables must be explicitly declared and suffixes should not be used. The use of Option Explicit is recommended to turn of support for implicit declarations, so that mistyped variable names are caught at compile time by the compiler.
See also
|