🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: perl.ppt
Article #1

Re: factor bug

#1
From: Philip Newton
Date: Sat, 19 Apr 2014 09:12
21 lines
2789 bytes
On 17 April 2014 02:08, Dave Nunn <david.s.nunn@gmail.com> wrote:
> The bug is presumably in the line:
> $max-- if $max %2;                   # Make the max odd
> as this does NOT force $max to be odd, but rather even.
> Not sure if the preferred rectification is:
> $max++ unless $max %2;
> -or-
> $max-- unless $max %2;
> though either works for the specific case of 3599.

Or why not replace the "if" clause with "if ($max % 2) == 0".

% is not a boolean operator, and I think that an explicit comparison
will make it clearer what exactly is being tested.

(I have similar feelings about people who write "if(strcmp(foo, bar))" in C.)

Cheers,
Philip
-- 
Philip Newton <philip.newton@gmail.com>
Technical Details
Message-ID: <CA+cwSm9_vC2ZSrmd1qj7zjm0kL74Bq5RptHHOCsaHyDbKp1+GA@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-perl.ppt.20140724.mbox.gz!border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news.glorb.com!usenet.stanford.edu!nntp.perl.org
References: <CAB6ToBg-+=83tm1V2o0955=_w8VzJL-ST08NpFf-GQbQR8becw@mail.gmail.com>

Show Full Headers
Complete Article Headers
Message-ID: <CA+cwSm9_vC2ZSrmd1qj7zjm0kL74Bq5RptHHOCsaHyDbKp1+GA@mail.gmail.com>
Subject: Re: factor bug
Date: Sat, 19 Apr 2014 11:12:00 +0200
From: philip.newton@gmail.com (Philip Newton)
References: <CAB6ToBg-+=83tm1V2o0955=_w8VzJL-ST08NpFf-GQbQR8becw@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-perl.ppt.20140724.mbox.gz!border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news.glorb.com!usenet.stanford.edu!nntp.perl.org
Newsgroups: perl.ppt
Return-Path: <philip.newton@gmail.com>
Mailing-List: contact ppt-help@perl.org; run by ezmlm
Delivered-To: mailing list ppt@perl.org
Delivered-To: ppt@perl.org
X-Spam-Status: No, hits=-2.7 required=8.0
 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM,
 RCVD_IN_DNSWL_LOW, SPF_PASS
X-Spam-Check-By: la.mx.develooper.com
 by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP;
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to
 :cc:content-type;
 bh=rxXTQ7oSzI5vKl54EzB+qIi7yVk9yQGRx/d20AlpN5s=;
 b=VC7FsqQjYVPLaA54xCLWHioqiOTv72ij0KeKjUA8eYC0aA3h+7kPeKWlAozGZqk2FQ
 9vnAQITudxVviv8eJ+uI++eEZ2YE2r+0BBxTmHD3RO37qq7I2+k2aPDoUfKMxBVBaLR7
 jp/+NWfJ65d02hw7ty12snYONy+Og0D1I7kN8jX4U4U/9CSsPgHY+owIPDJVjscsY0kq
 XOhyRSHBd+CvePwjaExZgC8uALVzE11EtQG8kAJ4bLU3WpKWdhwrFhAaB+pbBeXBFma2
 7CBL4B/JsoQirvmwDZ2BLmtu/FYIzopK1ASLdMf4EQkjIFaa025jJJhVQCNAB17cn1oK
 Fqlg==
X-Received: by 10.60.176.39 with SMTP id cf7mr1291080oec.45.1397898740845;
MIME-Version: 1.0
In-Reply-To: <CAB6ToBg-+=83tm1V2o0955=_w8VzJL-ST08NpFf-GQbQR8becw@mail.gmail.com>
To: Dave Nunn <david.s.nunn@gmail.com>
Cc: ppt@perl.org
Content-Type: text/plain; charset=UTF-8
Approved: news@nntp.perl.org
X-Received-Bytes: 3179
Lines: 20
X-Original-Bytes: 2769