Hi all,
We're trying to figure out why the last case below doesn't work on Linux, but works on MacOS. Does anyone have an explanation?
The docs suggest that _double* shouldn't be different from _double for _reading_ values.
More precisely,
#lang racket
(require ffi/unsafe)
(define N 10)
(define pt (malloc N _double 'atomic-interior))
(for ([i (in-range N)])
(ptr-set! pt _double* i (+ 2. i)))
;; works
(for/list ([i (in-range N)])
(ptr-ref pt _double i))
;; works
(for/list ([i (in-range N)])
(ptr-ref (ptr-add pt i _double) _double*))
;; doesn't work!
(for/list ([i (in-range N)])
(ptr-ref (ptr-add pt i _double) _double))
------
Output:
(2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
(2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0)
(2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0)