On Jan 22, 2007, at 4:23 PM, Daniel Stenning wrote:
http://www.realsoftware.com/feedback/viewreport.php?reportid=forgezvx
When dealing with declares or ptr, currently the only way of
accessing a C
array via a PTR variable is by using a byte offset. It would be
much more
readable and helpful if one could also access C array elements in a
manner
similar to C -
one solution might be to use [index] as opposed to (index)
so we could write:
dim myCInt64ArrayPointer as Ptr = getMyPointer()
dim myElement as Int64 = Ptr.Int64[8]
note that whereas dim myElement as Int64 = Ptr.Int64(8) returns the
second
element as an offset of 8 gives us the second Int64 in the array
dim myElement as Int64 = Ptr.Int64[8] would return the 8th element
- ie
using
an offset from Ptr of 8X8 bytes.
Sign on here if this is of use to you:
http://www.realsoftware.com/feedback/viewreport.php?reportid=forgezvx
this would apply naturally to pointers to arrays of structs - so we
could
write:
dim myElement as myStruct = Ptr. myStruct[8] would again return the
8th
element.
this saves a lot of tedious offset calculations and makes such code
potentially faster and readable.
Why would it make code potentially faster and readable? I find the
former hard to believe, and certainly disagree with the latter.
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>