*pointer.POINT = AllocateMemory(100*SizeOf(POINT))
*savedPointer = *pointer
For i = 0 To 99
*pointer\x = i
*pointer\y = -i
*pointer+SizeOf(POINT)
Next
*pointer = *savedPointer
Structure pArray_Point
p.POINT[0]
EndStructure
*pointer.pArray_Point = AllocateMemory(100*SizeOf(POINT))
For i = 0 To 99
*pointer\p[i]\x = i
*pointer\p[i]\y = -i
Next
For i = 0 To 99
Debug *pointer\p[i]\x
Debug *pointer\p[i]\y
Next
Of course it would be better without this "dummy"-structure, but i think
you should make a second feature request as that isn't related to this one
PMV wrote:... but i think
you should make a second feature request as that isn't related to this one
I agree, the suggestion for pointers and array access belongs in a new thread. I have one more comment on it though. It seems like it would be limited to just the highest level of the structure as a whole. It would definitely cause confusion if it was usable when dereferencing any nested sub-structures. If it was desirable to also access sub-structures this way (i.e. *ptr[5]\b[3]\etc[13]) then perhaps an additional bracket type could be used to differentiate . This would make the structure definitions of 'Structure MISC: i.i: EndStructure: Structure TEST: b.b[9]: *etc.MISC: EndStructure' and the pointer '*ptr.TEST', accessible with '*ptr{5}\b[3]\etc{13}\i' instead of merely being limited to '*ptr[5]\b[3]\etc\i'. I may be over-thinking things though.
Regarding the 'first' topic of this thread, I do not think it is a good idea to implement pointers of 'standard types' by replacing the types with structures. It is better to prevent using a standard type with a pointer declaration so that this wayward practice (of using standard types with pointers) can be done away with. That would work better to eliminate the confusion.
@Edit: Added a more confusing example to 'side-thread'.
imho they should disable *pointer.l etc since its useless. so if we want to use something like that, we are forced to write *pointer.long, which is imho the better way. an automatic .l -> .long transition would be kinda confusing.
I think a simpler alternative would be to support passing variables to procedures by reference. This would prevent the addition of a possible confusing syntax where a .<type> has different behavior depending on a * prefix.. but only for basic types.. etc.