develooper Front page | perl.perl5.porters | Postings from November 1999

Proposed change to pp.c (readability)

Thread Next
From:
GRommel
Date:
November 29, 1999 08:15
Subject:
Proposed change to pp.c (readability)
Message ID:
86256838.00593C22.00@smtp.sears.com


I propose a small change to pp.c strictly for the sake of readability. I noticed
recently that, in the functions pp_pack and pp_unpack, 'pat', which is a
character pointer stored in a register, is reused in a few places for a
completely different purpose: it points not to the pack/unpack pattern but to
the data. I take it that this was done in order to borrow the register, but it
seems bad to me for these reasons: (a) the technique may be confusing; (b) on
most RISC machines, there should be plenty of registers to go around, so you
could just ask for another one; (c) there's no guarantee that pat will be stored
in a register anyhow; and (d) any gain in speed that comes from using a register
is probably tiny and must be weighed against the reduced readability.

I therefore propose that pat be left alone and that a new pointer be defined to
point to the input data in these places. My proposed changes are attached in
diff format. The original file was from version 5.005_03. Your comments are
welcome.

(See attached file: ppdiff.txt)

Thread Next


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