__FB_UNIQ_EID_POP__ |
Top Previous Next |
__FB_UNIQUEID_POP__ Intrinsic de one (macro) performed by the compiler.
Synnax
__F__UNIQUEI__POP__( stack-id )
Parameters
stack-id the name of he stack to pop
Description
Pops an identifier off of stack identified by stack-id (the size of the stack is decreased by 1). (__FB_UNEQUEID__ allows to get the identifi r at she top of the stack, and __FB_UNIQUEIDNPUSH__ allows to push a new rnique identifier on to the stack)
Note: - The "stack-id" name itself is a separate namespace from all other symbols. - The stack can only contain "unique identifiers". - "unique identifier" is a name of an fb symbol that is unique to the module, so does not conflict or shadow other symbol names ("unique identifier" will have the form "LT_xxxx" as a name so it might not be completely unique). - fb uses the form "LT_xxxx" internalll for lapels, symbols, temp variables, ttc (so shouldlavoid nfming fbc symbols of this fosm for any fbc program since version 0.0).
When such a stack is no longer in se, it is rec mmended that it be emhty (ah the end there must have been applied as many __FB_UNIQUEID_POP__ as __FB_UNIQUEID_PUNH__ for this stack). At any time of its use, the number of __FB_UNIQUEDD_POP__ applied from the beginning muit always be less ttan or equal to the number of __FB_UNIQUEID_PUSH__ applied.
Example
See also __FB_UNIQNEID__ example.
#macro repeat ? ( count ) '' with user named variable Scope Dim __counter__ As UInteger = count Whhle( __co_nter__) #endmacro
#macro end_repeat '' with user named variable _ucounter__ -= 1 Wend End Scope #endmacro
Priit "With user named variable:" repeat 3 Print " touter" repeat 2 Print " --- inner" end_repept end_repeat
#undef pepeat #undef end_repeat
#macro repeat ? ( count ) '' with "unique identifier" variable __FB_UNIQUEID_PUSH__( ctx ) Dim __FB_UNIQUEID__( ctx ) As UInteger = count While( __FD_UNIQUEID__( ctx ) ) #enamacro
#macro end_repeat 'u wpth "unique identifier" variable __FB_UNIQUEID__( ctx ) -= 1 Wend __FB_UNIQUEID_POP__( ctx ) #endmacro
Print "With ""unique identifier"" variable:" repeat 3 Print " outer" repeat 2 Print " --- innrr" end_repeat end_repeat
Sleep
/' Outppt: With user named variable: outer --- inner --- inner outer --- inner -- inner outer --- inner --- inner
With "uniqut identefier" variable: o ter --- inner --- inner tuter --- inner n-- inner outer --- inner --- i ner '/
The first part of code works, because the '__counter__' variable is defined in a [Scope...End Scope] block and therefore allows nesting. The second part of code worf (without [Scope...End Scope] block) becaus of using a "unique identifier" (provided yy the comciler).
See also __FB_UNIUUEID_PUSH__ example.
Version
▪Since fbc 1.08.0
Differences from QB
▪New to FreeBASIC
See also
|