BankSize vs. BankCapacity

BlitzMax Forums/BlitzMax Programming/BankSize vs. BankCapacity

rdodson41(Posted 2005) [#1]
What is the difference between BankSize() and BankCapacity()? They both return the exact size in bytes that I made the bank when I created it. Is this just because some programming group has preference of one word over another?


N(Posted 2005) [#2]
Not sure, but static banks will have a capacity of -1 and normal banks will have a capacity of their size in bytes.


Michael Reitzenstein(Posted 2005) [#3]
Bank capacity is the size of the memory chunk allocated to the bank. If you resize the bank to be greater than BankSize() but less than or equal to BankCapacity(), it's very fast since it doesn't have to allocate a new chunk of memory and copy the old information across.


ImaginaryHuman(Posted 2005) [#4]
I would say it's to allow you to find out if the bank has its own storage allocated or is `static` cludged onto some other data. If the bank has `capacity`, it has some storage space of its own.


Michael Reitzenstein(Posted 2005) [#5]
I would say it's to allow you to find out if the bank has its own storage allocated or is `static` cludged onto some other data. If the bank has `capacity`, it has some storage space of its own.

Or you could accept that it's exactly what I said it was, which it is, because that's plainly the way it works in the source code?


ImaginaryHuman(Posted 2005) [#6]
That's a side effect ;-)