Hi Jason,

> But I have to respectfully disagree - 'struct' should know
> that if its current offset is 10, and it next needs to layout
> a 4-byte integer, it should insert 2 pad bytes to begin

Equally respectful I have to re-disagree ;)

1. "'struct' should know" is not the case. It should just do what it is told,
   not trying to be clever.

   What if I *want* the above layout? 4 bytes at offset 10. I do not want
   'struct' to do something behind the scenes without need.

2. The reference for the 'native' and 'struct' initialization items says: "a
   pair (num . cnt) where 'num' is stored in a field of 'cnt' bytes". It says
   nothing about an integer.


Let me give an example of a use case. Let's say I want a fast way to store 8
bytes, with a single instruction, in memmory. Why should 'struct' stop me?

   (buf Ptr 10
      (struct Ptr NIL '(82 . 1) '(8243127052830861157 . 8) 0)
      (println (struct Ptr '(B . 10)))
      (println (struct Ptr 'S)) )
   (82 101 103 101 110 97 120 101 114 0 95 9 88 0 0 0)
   "Regenaxer"

I *want* to be able to store an 8-byte value at an offset of 1, if the hardware
allows it.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to