Re: Bug in &= (bitwise or)



[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
.



Relevant Pages

  • Re: Problem with list.insert
    ... Python docs which gives examples like these, ... MY EXPEPECTED STRING IS: ... print "OUTPUT STRING IS" ...
    (comp.lang.python)
  • Re: Writing Custom Aggregate Functions
    ... and loop through the records building up the output string. ... textbox in the group footer of my report using the syntax: ...
    (microsoft.public.access.reports)
  • Re: TrasferText Error 3310
    ... output string to a text file using the Print command. ... Dim rs As DAO.Recordset ... Dim intFile As Integer ...
    (comp.databases.ms-access)
  • Re: How to retrieve a methods name as a string?
    ... I don't want to hard code this value ... remembering to change the output string. ... time error if the dev forgot to keep something in synch. ...
    (microsoft.public.dotnet.languages.csharp)
  • How to retrieve a methods name as a string?
    ... I don't want to hard code this value ... remembering to change the output string. ... error if the dev forgot to keep something in synch. ...
    (microsoft.public.dotnet.languages.csharp)