C++ Pointers

Blitz3D Forums/Blitz3D Programming/C++ Pointers

Craig H. Nisbet(Posted 2003) [#1]
Hi all,

I just started using C++. I really had a hard time rapping my head around the pointer thing. Anyway, comming to the conclusion that some day I will figure out a good use for them. Well, I found it while coding in blitz. I found I was constantly using functions to get position info from an entity, and I thought,"gee it would be nice if I had a pointer to just the X position of the entity". Then I wouldn't have to call these function to get and apply values to the position. I think C programmer will understand this. Does anyone know if there is any pointer support at all in blitz, or am I just barking up a tree that a thousand other people have barked up?


SopiSoft(Posted 2003) [#2]
There is the Object() and Handle() commands in Blitz but they arent real pointers like the ones in C/C++
These commands are used to directly get to a type field without the need to loop through the type list, kinda like you do in C/C++ with pointers...


Ken Lynch(Posted 2003) [#3]
No, there are no equivalents to pointers for getting info from entities. There are banks, which allow you to reserve memory and 'peek' and 'poke' information in or out and there are types, which are sort of like c++ classes without all the good bits like methods and inheritance - though there is a posibility that this will change in the future ;-D


Pepsi(Posted 2003) [#4]
Craig, I'm 100% with you on this, but I barked up that tree a year or two ago(forget when now) and Mark Sibly slapped me around like a redheaded step child and basically said "NO!". I had a good feature request going on it on how useful Real C/C++ pointers are too. I personaly love the hecks out of pointers and know for a fact how much more powerful the blitz programming language could be if it had pointers like C/C++ have. I'm not just talking about function parameter reference passing either.

The closest thing to a pointer that I can see with blitz is through using userlibs. You can have a * to access a blitz bank to/from a dll. Then like what Ken said above, you can set up a bank like a C structure (struct definition, not a C++ class) that you have defined in your dll to access.

[With a voice like Arnold Schwarzenegger:]
It's a crying shame that blitz doesn't use Real Manly Pointers like C/C++ has, IMHO, instead of dodging around like Java does with sissy safe pointers, IMHO. So I gave up trying to support the good cause and abandon all hope for this dream of ultimate power.

(*cough* I need another beer)