--- In [email protected], "swzoh" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "swzoh" <seanzoh@> wrote:
> > The length of the byteblock "xString" always return 263. I became
> > curious why it's not 2*2 or 266:
> > 
> > 266 = 272 - 1 - 4 - 1
> > 
> > where 1-byte header, 4-byte size as int, 1-byte eos.
> > 
> > My conjecture is that the header is not 1-byte, but actually 4-byte.
> > Some kind of Struct Packing arose here, I suppose:

Yup.  Sean has chastised me for using a CHAR in a struct.  

I'll revise at some point.

But see below.

binary.length, BTW, probably should be called binary.capacity:
it's always the available space in a byteblock.

binary.length (the actual number of real bytes in use in a byteblock)
is neither necessary or feasible, IMO.

 -- all the API calls I've run into so far that fill a BYTE array 
    also return a byte-count, or require a byte-count as an argument:
    so the user ASAIK always has a way of knowing how many bytes 
    have been returned.

 -- Furthermore, how can a byteblock know how many of it's bytes are 
    "real"?  There's no magic terminating null.  A byteblock doesn't 
    know whether it's been passed through an API call that's filled 
    it, so it has no idea how manh of it's bytes matter.
 
    The only a byteblock can know how many of its bytes are real is
    if the byteblock's tells it: e.g. some service like
    binary.set_length.  But doesn't seem much point.

I'll rename binary.length to binary.capacity at some point.

Also: I wonder if all this messing about with byteblocks read and
written straight to variables is a good idea.  

Should binary instead return and require handles, like unicode?  It
would mean you wouldn't have remember to use the name of a variable,
instead of a variable, in calls to binary.  And you could use the
handle.service syntax.

Reactions?








Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to