Pointers *Shudder*

BlitzMax Forums/BlitzMax Programming/Pointers *Shudder*

Leiden(Posted 2006) [#1]
Kind of confused about their usage, I know how to use them in C/C++ (basics anyway) but using them in BlitzMax is another story.

Some code might explain it a little better:

C

struct _mystruct
{
   int value;
}mystruct;

mystruct *structs = 0;


In blitzmax, would that simply be an array of undefined size of type mystruct?

In a little more detail... I have some C code I wrote that I want to port over to BlitzMax. In the code I'm doing the same as above. I'm using malloc to initialize the structs to the size of one 'mystruct'.

Is there an equilavent of that in BlitzMax?


Winni(Posted 2006) [#2]
How about using simple objects instead of structures and storing them in a TList?

Type MyStruct
   Field Value:Int
End Type


MyStructList:TList = New TList

MyStructObj:MyStruct = New MyStruct
MyStructObj.Value = 0;
MyStructList.AddLast MyStructObj



Leiden(Posted 2006) [#3]
I was trying to avoid using Lists as they are slow at parsing the values back. And with vertices you need all the speed you can get. I might just code it in C and wrap it to BMax.


Dreamora(Posted 2006) [#4]
If you want to do vertices, make an array of float. Array of Type isn't the same as a struct array and won't work the same. You would need to manually feed whatever you wanted with the vertex data instead of just passing the array.


Leiden(Posted 2006) [#5]
I'm not really feeding them into GL as an array. I'm just playing around with alternate methods to see if I get any boost *unlikely* or whatever.