[futurebasic] Dimming vars

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 1999 : Group Archive : Group : All Groups

From: Richard Phillips <rpphillips@...>
Date: Sat, 31 Jul 1999 19:39:25 -0600
Several days ago Derek Smith wrote...
> This is a sort of warning/preparation statement for FB
> users.
> I've noticed from a couple of people lately that they dim
> a local variable that has the same name as a parameter.
> Two examples:
> DIM x!
> LOCAL FN doStuff (x!)
>         ...etc
> or
> LOCAL FN DoStuff (x!)
>   DIM x!
>         ...etc
    I wasn't aware that parameter variables should NOT be dimensioned.  I have
always DIMmed them.  After reading Derek's message I just assumed that I'd have
to go back over the ten zillion routines I've written and eliminate the lines
that dimension parameter variables.
    But then I remembered that when it comes to defining string variables, if a
new string length is NOT defined using the "DIM" or "DEF LEN" instructions,
then the most recently defined string length value is instead used.
    So what happens, for example, if the previously allocated string is defined
at seven bytes in length (8 with length byte), but I need my "not to be DIMmed"
parameter string to occupy a full 255 bytes long (256 with length byte)?
    Can I use the "DEF LEN" instruction to force a new length?  And if so,
where do I place this instruction so that the compiler will "see" it BEFORE my
parameter string is actually defined?
    Or did I miss Derek's point altogether and I'm concerned about a situation
that doesn't exist?
    Thanks, folks!