[futurebasic] Re: [FB] Local variable dimming

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2005 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Tue, 1 Nov 2005 21:32:09 +1300
Bernie wrote:
> While we're talking optimisation, are there any advantages/ 
> disadvantages with the following methods of dimming local vars?
> (1)
> local mode
> dim as Str255   s
> dim as long     value
> dim as Boolean  bool
> local fn MyFunction
> '...
> end fn
>
> (2)
> local mode
> local fn MyFunction
> dim as Str255   s
> dim as long     value
> dim as Boolean  bool
> '...
> end fn


The first 8 "register-compatible" variables or parameters encountered  
are placed in registers. "Register-compatible" means byte-, short- or  
long-sized simple variable or parameter, modified by:
    Preferences > Advanced > Use register variables for speed
    Preferences > Advanced > Use only "Longs" in registers

With your variables and MyFunction that takes no parameters, the two  
ways of writing the function are -- it is plain -- precisely  
equivalent, even to the PowerPC register (r15) occupied by 'value'.

Robert P.