Point type to memmory data.

BlitzPlus Forums/BlitzPlus Programming/Point type to memmory data.

Wings(Posted 2006) [#1]
I creacy.. you all know that !

and for those who dont.
I wish to Point a variable.type - > memmory bank

so i can read values widout the PeekInt etc etc..

i know this kind of pointing is dangerus.. why else whold i want to do it :)


CS_TBL(Posted 2006) [#2]
O_o ...uuuuuuuuuuuuuuuhhhhhm... o_O

Not *quite* sure what to make of this question, but here's my guess:

You have a value stored in a bank and you wish to read out that variable without using peekint|peekshort|peekfloat? If so, make wrapper functions.. like:
Function GetVariableX(bank)
  Return PeekInt(bank,13) ; 13 being the location of your variable..
End Function



Wings(Posted 2006) [#3]
Hmmm nope..

I was wanting to use type pointer and point the type to the memmory.. like in c++

(Cause of the speed gain for the server computing.)

right now i use peekint etc.. even worse i copy strings with a$=a$+chr$(peekbyte())

thats realy low.. like glocalnet. :)


CS_TBL(Posted 2006) [#4]
B+ doesn't have pointers, closest thing being a pointer in B+ is poke/peek with banks.


aab(Posted 2006) [#5]
Types have pointer properties when it comes to passing them, but because of the way they are auto-containered by Blitz, theres no way to make a type/object pointer that points to and already allocated location.
Would it be good though lol..We could have:
type my_type
field v%
end type
bank%=CreateBank(4);
instance.my_type = Object.my_type(CreateBank);
But that'll never happen.

Your could be better off just using a global dynamic array and redimming it, but then for byte access youd have to shift and & the stuff. Though youd have to copy the data to resize the array, thats what'll happen when resizing a bank anyway.