In 3!:n the value part of one-byte types is indeed terminated with an extra 0 byte, and then rounded up to the next mword.
For your particular example, try looking at the parts as well as the whole: 3!:3 'test' 3!:3 'abcd' 3!:3 'test';'abcd' ----- Original Message ----- From: Gilles Kirouac <[EMAIL PROTECTED]> Date: Monday, August 14, 2006 8:11 am Subject: Re: [Jbeta] 3!:1 and 3!:3 What are these zeros? > I guess it has to be the need for a NUL terminating a c-string. > > But now what is the 38 in the following: > > hexdump 3!:1 (<'test'),<'abcd' > 00 E1 00 00 00-20 00 00 00 02 00 00 00-01 00 00 00 │... > .........│10 02 00 00 00-1C 00 00 00 38 00 00 00-E1 00 > 00 00 │......8......│ > 20 02 00 00 00-04 00 00 00 01 00 00 00-04 00 00 00 > │............│30 74 65 73 74-00 00 00 00 E1 00 > 00 00-02 00 00 00 │test..........│ > 40 04 00 00 00-01 00 00 00 04 00 00 00-61 62 63 64 > │.........abcd│50 00 00 00 00 > │.... │ > > I am trying to use the Simple Socket Server class from a non-J > environment. Since this class rests on 3!:1 and it is preferable > to use it as it is, I need to emulate 3!:1. Having a model in J > would help. > > The Simple Socket Client/Server classes and the related lab > are clear and simple. Thanks, Eric! > > Gilles > > ---------- Original Message ----------- > From: "Gilles Kirouac" <[EMAIL PROTECTED]> > To: Beta forum <[email protected]> > Sent: Mon, 14 Aug 2006 02:08:17 -0400 > Subject: [Jbeta] 3!:1 and 3!:3 What are these zeros? > > > Are the terminating zeros padding? > > When are four zeros added? > > The terminating byte should be a zero > > padded to the full word: is this the rule? > > I do not see those zeros mentioned in the doc. > > > > 3!:3 '123' > > e1000000 > > 02000000 > > 03000000 > > 01000000 > > 03000000 > > 31323300 > > 3!:3 '1234' > > e1000000 > > 02000000 > > 04000000 > > 01000000 > > 04000000 > > 31323334 > > 00000000 > > 3!:3 '12345' > > e1000000 > > 02000000 > > 05000000 > > 01000000 > > 05000000 > > 31323334 > > 35000000 > > 3!:3 '12345678' > > e1000000 > > 02000000 > > 08000000 > > 01000000 > > 08000000 > > 31323334 > > 35363738 > > 00000000 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
