Why no "type checking" for C arrays?

Berthold Bäuml <[email protected]>
Newsgroups gmane.comp.lang.racket.user,gmane.lisp.scheme.plt
Message-ID <[email protected]>
When copying a C array into a a field of a C struct there seems to be no “type checking”, i.e., at least a check for element type and array length/size. This leads to a Segmentation fault when running the code below. Could such a check be added? The relevant information should be available to (make-ct or set-ct-arr …).


#lang racket
(require ffi/unsafe)

(define _at2 (_array _double 5000000))
(define _at1 (_array _double 5))

(define-cstruct _ct ([arr _at2]))
(define a (ptr-ref (malloc _at1) _at1))
(define c (make-ct a))


Best,
Berthold

-- 
-----------------------------------------------------------------------
Berthold Bäuml -- Head of Autonomous Learning Robots Lab
DLR, Robotics and Mechatronics Center (RMC)
Münchner Str. 20, D-82234 Wessling
Phone +49 8153 282489
http://www.robotic.de/Berthold.Baeuml

-- 
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.