[futurebasic] Re: [FB] BLOCKMOVE Does What Now???

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

From: tedd <tedd@...>
Date: Sun, 31 Oct 1999 10:21:45 -0400
>    I've got a question about the guts of BLOCKMOVE that I'm hoping someone
>might be able to clear up for me.
>    Obviously BLOCKMOVE works pretty well when you're moving a bunch of bytes
>from here to way over there.  But what if I need to slide a given block of
>bytes only a few positions forward or backward of their original address?  My
>guess is that BLOCKMOVE moves one byte at a time starting at the passed
>addresses, and incrementing one address position for each additional byte
>BLOCKMOVE has completed its task.
>    If the above assumption is correct, what if I need (for example) to
>free up
>three bytes at the head of a 1,000 byte handle (this handle has been allocated
>to a size of a zillion bytes).  Normally I'd do this by sliding the current
>(example) 1,000 bytes in the handle "back" by three bytes.  Using a BLOCKMOVE
>for this purpose will work for the first three bytes, but after that it'll be
>copying bytes that it has already moved (in other words, the data becomes
>    Is the following a good rule-of-thumb when using BLOCKMOVE???  If the
>number of bytes to move is greater than the the distance to move, first make a
>copy of the original data and copy from that.
>    Or does BLOCKMOVE work in some other way that means that the above
>situation isn't a problem?
>    Thanks!
>    -Rick


I'm no authority on BLOCKMOVE, but I typically use a BLOCKMOVE to move
everything regardless of how little I'm adding/substracting to the block of
memory. In other words, I don't attempt to slide anything forward or
backward. I believe (someone please correct me if I'm wrong) that BLOCKMOVE
is pretty quick -- so I don't think that you're saving any time by sliding
things around. In fact, you may be causing more delay.

Another thing to consider, is that you may not always have three bytes at
the "head of a handle" (start I assume) or at the end of the block of
memory (That's the memory manager's job to keep track of). So, that
additional memory may be already allocated to another variable. If so, then
that can cause problems that can be very hard to track down. My advice, let
the memory manager do its thing and do complete BLOCKMOVE's without
worrying where the block is going.


<mailto:tedd@...>	               http://sperling.com/