[futurebasic] Re: [FB] Does FB^3 add an element

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2001 : Group Archive : Group : All Groups

From: Alain Pastor <apastor@...>
Date: Sun, 07 Jan 2001 20:57:25 +0100

pochas wrote:

> > >So if I 'ask' the compiler for an array with ten elements, do I get ten or
>      >eleven elements in the array ??
> > >
> > >So confused, it hurts my brain
> > >
>      >Pete aka "Mr. Gumby"
>
> > zero thru 10 = 11 elements
>
> > Best,
>
> >  -STAZ  ~)~
>
> Well, while we're on this scintillating topic,  could we pursue it just
> one
> step further, to its obstreperous conclusion in the land of MacHandle?
>
> When we iterate myHandle& = fn newhandle(0),  well,  how many bites 'ave we
> purchased?
>

Hi,
my understanding is that you are asking for a block in memory with 0 byte in
length for the data.
The block has a blockheader whose size is just a little less than 2 billion
terabytes since it is 12 bytes according to Inside Mac, if the information I get
is not outdated. In fact, I think you can test the following piece of code:

DIM memory&,x&,i&

memory& = FN FreeMem
FOR i& = 1 TO 100
x& = FN NewHandle(0)
NEXT
memory& = memory& - FN FreeMem

PRINT memory&/100

On my computer the result gives 32 bytes per block (that's why I think my
information was not valid any longer)

>
> And, meLaddie,  what about sethandlesize(myHandle&, 0) , now?  Did we
> really get rid of the little rascal?  Or is there still a token of a wee
> byte there that could hold a single character?

With the SetHandleSize call you are telling how much memory the data will occupy
in that block.
So with a size of 0 byte, you don't get rid of the block itself but just the
data that previously fit in the block.. Even if you push the thing very hard
with both hands, I think you cannot put a single (even tiny) char in that room.
Don't take my words for granted it is just how I feel the things are going.

Hope this helps anyway.

Cheers

Alain