On Mon, 19 Sep 2005, Nicholas Clark wrote: > > Merijn notices this line in 5.8.x in S_new_logop > > if ((type == OP_AND) == (SvTRUE(((SVOP*)first)->op_sv))) { > > It's wonky. It seems to be wrong. But it's been that way since 5.8.0 started. > > The corresponding point in blead is > > if ((type == OP_AND && SvTRUE(((SVOP*)first)->op_sv)) || > (type == OP_OR && !SvTRUE(((SVOP*)first)->op_sv)) || > (type == OP_DOR && !SvOK(((SVOP*)first)->op_sv))) { > > > This was patched by Marcus Holland-Moritz, changing that == to && in the > process: > > http://public.activestate.com/cgi-bin/perlbrowse?patch=22625 > > Presumably '==' is wrong. But if this is a bug, how can it be detected > with a perl level regression test?
If type can *only* be either OP_AND or OP_OR, then the code is actually equivalent as far as I can tell. The second form is just more robust in case type can assume any other value. Cheers, -Jan