binary-structures icon indicating copy to clipboard operation
binary-structures copied to clipboard

unsized strings and vectors don't work

Open 3b opened this issue 2 years ago • 1 comments

(define-io-structure a
  (a (vector (unsigned-byte 8))))

or

(define-io-structure a
  (a string))

error during compilation with

No io-type with name
  *

(and code for strings looks like it would inherit the "until end of input" behavior from vector rather than "until 0-termination byte" implied by docs)

3b avatar Dec 23 '23 17:12 3b

Yeah the issue here is that the backend assumes it can always know the size of the vector ahead of time, so it can allocate it once and then fill it. For some backends it can estimate the size based on the remaining space, but for non-file streams for instance it wouldn't know how much is left, requiring a much more expensive path.

Shinmera avatar Jul 11 '24 19:07 Shinmera