develooper Front page | perl.perl5.porters | Postings from April 2000

Re: [ID 20000425.002] Minor bug fix and enhancement to to pp.c:pp_pack()

Thread Previous
From:
Ilya Zakharevich
Date:
April 26, 2000 13:05
Subject:
Re: [ID 20000425.002] Minor bug fix and enhancement to to pp.c:pp_pack()
Message ID:
20000426160427.A18751@monk.mps.ohio-state.edu
On Wed, Apr 26, 2000 at 08:55:42PM +0100, John Holdsworth wrote:

> > > > > Included is a bug fix to the decode of unpack 'N/Z*' which
> > > > > was not adding a byte to the encoded length as pack does.

  DB<1> x pack "N/Z* a4", "hi there ", "1234"; 
0  "\c@\c@\c@\cIhi there \c@1234"
  DB<2> x chr 9
0  "\cI"
  DB<3> x length "hi there "
0  9

This is clearly a bug.  Either \0 should not have been inserted, or
(better) the length should have been marked as 10.

But this is a bug in pack().  I do not see why any change should be
done to unpack().

> > I can easily believe that the feature you wanted to add is desirable,
> > but until we can invent a more intuitive and more general "API". I do
> > not think that what you did should go in.
> 
> No problem, how it is represented in the template is going to
> require more discussion. I am mainly putting forward the idea.

I do not care which letter represents "it" in the template.  I care
that "it" which you implemented looks ad hoc and may not generalize to
other useful situations.

Ilya

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About