[racket] using s16vector-set! on malloc'ed values

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Oct 25 17:47:16 EDT 2013

At Fri, 25 Oct 2013 15:42:03 -0600, Matthew Flatt wrote:
> At Fri, 25 Oct 2013 14:28:13 -0700, John Clements wrote:
> > If I understand correctly, this is because this is taking the "pointer 
> > value"--probably an 8-byte or 16-byte structure that holds a pointer--and 
> > treats it like it's a massive s16vector.
> 
> Not quite. Both a plain pointer and an `s16vector` value are
> represented as a wrapper that points to the actual array, but the
> pointer is in a slightly different place inside each kind of wrapper.

FWIW, after thinking about it more, my explanation isn't quite right.

It's more the other way around: an `s16vector` is represented as a
struct that holds a cpointer, which is a record that points to the
actual array. So, you had 1 level of indirection where 2 were expected
(instead of 1 level where 0 were expected).


Posted on the users mailing list.