[MacRuby-devel] Understanding Pointer objects
Caio Chassot
lists at caiochassot.com
Sun Oct 24 11:09:21 PDT 2010
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?
More information about the MacRuby-devel
mailing list