[futurebasic] Re: [FB] Defining strings of arbitrary length?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2000 : Group Archive : Group : All Groups

From: Joe Lewis Wilkins <PepeToo@...>
Date: Sun, 29 Oct 2000 15:25:49 -0800
Robert, Robin,

We/"Certainly I" thank you.  Now I know why I've encountered some of the
problems that I have in the past.  I was always able to "resolve" them; now I
know I didn't even have to "have" them.  I can't imagine where I picked up such
a bad habit.

Joe Wilkins
alias "Mr. Wilkins"  <grin> Oh! those aching bones! and that misbehaving
eyesight!

Robin wrote:

> >> Are you then saying that :
> >>
> >> DIM aStr$;14
> >>
> >> isn't good anymore either?
> >
> > It's not so much "not good" as "very risky", as you are assigning 14 bytes
> > of memory (before the contents run into whatever follows) to a string that
> > the runtime will happily fill with 256 bytes.
> >
> Sorry, I should have explained that better.
>
> The reason it is risky is that if you omit the # characters from a string
> DIM, FB makes it the default DIM (255 chars). Thus
>
> DIM aStr$;14
>
> Is actually:
>
> DIM 255 aStr$;14
>
> while the ;14 forces FB to offsets the start of the next variable to a mere
> 14 bytes past the start of aStr$. Hence the risk.
>
> --
> Robin
> ====================================================
> Genesearch Pty Ltd
> E-mail: robinc@...
> WWW:    http://www.genesearch.com.au
> ====================================================
>
> --
> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>