24 Oct
2010
24 Oct
'10
6:09 p.m.
On 2010-10-24, at 05:06 , Matt Aimonetti wrote: Is there any difference if I do these instead:
pointer = Pointer.new_with_type("f")
p = Pointer.new(:float) #<= new instead of new_with_type
pointer.assign(3.2)
p[0] = 3.2 #<= #[]= instead of #assign I have used both successfully in the past. Just wondering if I was just lucky or if they're fine. Also, what's with the #[] thing anyway? What would I get using p[1], p[2]? Is this a way to deal with C arrays or otherwise do basic pointer arithmetics?