Direct Pointer Variables in NG

BlitzMax Forums/BlitzMax NG/Direct Pointer Variables in NG

RustyKristi(Posted 2016) [#1]
Or whatever you call it in bmx, apparently this works in vanilla and not in NG or I don't know the new format..

Float Ptr [0.0, 0.0, 0.0, 0.0]

Compile Error: Syntax error - expecting ']'.


finding this on GL calls with the mods I'm checking out..

or you really have to do

Local myvar#[] = [0.0, 0.0, 0.0, 0.0] 
?


GW(Posted 2016) [#2]
Ya, you need to use a variable.
In blitmax, literal types were stored in the .data section and you could always get a pointer to them.
Not that way in C.

you can probably use "MemAlloc(4*4)" or somthing


RustyKristi(Posted 2016) [#3]
Thanks GW, because this is also valid with vanilla without using .data section

glLightfv( LightIndex, GL_POSITION, Float Ptr [0.0, 0.0, 0.0, 0.0,])


I guess I have to made those adjustments.


GW(Posted 2016) [#4]
it still uses the data section


RustyKristi(Posted 2016) [#5]
Thanks GW.


col(Posted 2016) [#6]
I think you wrap the array in parenthesis to achieve the same result?

Float Ptr ( [ 0.0, 0.0, 0.0, 0.0 ] )



Brucey(Posted 2016) [#7]
Float Ptr [0.0, 0.0, 0.0, 0.0]

This constructs a new 1 dimensional array with 4 elements, and then points to the address of the first entry.

Every time you call this code, it would create a new 1 dimensional array with 4 elements... etc. which is not very efficient :-)

That said, it's not parsing correctly in NG...