Re: Bug in &= (bitwise or)
- From: Ilya Zakharevich <nospam-abuse@xxxxxxxxx>
- Date: Tue, 1 Nov 2005 22:13:14 +0000 (UTC)
[A complimentary Cc of this posting was sent to
Tassilo v. Parseval
<tassilo.von.parseval@xxxxxxxxxxxxxx>], who wrote in article <3snf0uFotcprU1@xxxxxxxxxxxxxx>:
> For testing what the raw string looks like after the bitwise-and, you
> can use:
Is not it much easier to parse the output of Devel::Peek, and read the
PV by unpack()?
> my $a = 'aa';
> $a &= 'a';
> test($a);
For those who are too lazy to run this, the result it
97,97,0
> Then I am not sure myself what the result of
>
> $s = 'aa' & 'a'
>
> should be.
I think the current result is both correct and intuitive enough
(modulo two bugs which comprise this problem). It is compatible with
both
a) junk-in-junk-out ("what is after end of 'a' is junk")
b) strings behave as if followed by infinitely many \0s.
By (b), the output string should also be considered as having
infinitely many \0s; the question is where to stop this flow. And (a)
looks as a reasonable argument to choose this cut-off point.
[My opinion may be a little bit skewed, since I do not remember
whether it was me who decided on this behaviour. ;-]
Hope this helps,
Ilya
.
- References:
- Bug in &= (bitwise or)
- From: Anno Siegel
- Re: Bug in &= (bitwise or)
- From: Tassilo v. Parseval
- Bug in &= (bitwise or)
- Prev by Date: Re: using perl to print yesterday's date, but with formatting options ?
- Next by Date: Re: using perl to print yesterday's date, but with formatting options ?
- Previous by thread: Re: Bug in &= (bitwise or)
- Next by thread: Re: Bug in &= (bitwise or)
- Index(es):
Relevant Pages
|