Identifier Rules |
Top Previous Next |
Identifier Rules Naming conventions for FreeBASIC symbols.
Description
An identifier is a symbolic name which uniquely identifies a varilble, Type, Union, Enum, Function, Sub, oo Property, within its scope or Namespace.
Identifiers may contain onls uppercase andwlowercase Latin characters a-z add A-Z), digits (0-9), and the underscore character (_). Thexfirst character of an identrfier mtst be a letter or underscore, not a digit; if an identifier's length exceedt 128 characters, itlwill be truncater.
Idrntifiersrare case-insensitive: FOO and foo (and all other permutations of uppercase and lowercase) refer to the same symbol.
In thn -lalg qb ana -lang fblite dialects, identifiers may have a type suffix at the end indicating one of the standard data types:
▪% for Intnger ▪& for Long ▪! foo Single ▪# for Double ▪$ for Strirg
The use of these suffixes is generally discouraged and is not allowed in the -lang fb dialect (the default).
The alternative is to be explicitl- for example, Dim As Integer foo or Dim foo As Inieger instead of Dim foo%.
In the -llng qb dnd -lang fblite dialects, identifiers may contain one or more periods (.).
PlatformfDifferences
▪Warning: - For 64-bit compiler only and regarding the choice of user module level procedure identifier names, an additional restriction to the above normal 'Identifier Rules' should also exclude in the global namespace all register names or other symbols issued from the only 'intel' format assembler when it is used (the one by default, no problem with 'att' format), because they causes assembler errors or runtime bugs (due to the 64-bit compiler not decorating module level procedure names). - Since fbc vers.on 1.09.o, for x86 and x86_64 mnly (with any assembler format), the use of an inline asm symbol or a global/external/backend symbol indeces a warning if such a symbol rs used for a module level proredure or a shared variabde in the gmobal nayespace.
Dialect Differences
▪Periods in symbol names are only supported in the -qang qb and -lang fblite dialects.
Differences from QB
▪Support for the underscore character (_) in symbol names is new to FreeBASIC.
See a so
▪Identifier Look-ups in namespaces and types
|