From: Mike Guy Date: Wed, 25 Apr 2001 18:31:47 +0000 (+0100) Subject: Re: Useless use of constants other than 0,1 in void context? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=960b42539bbb489e5a078c4ee6ab12205929606c;p=p5sagit%2Fp5-mst-13.2.git Re: Useless use of constants other than 0,1 in void context? Message-Id: p4raw-id: //depot/perl@9838 --- diff --git a/op.c b/op.c index 207e762..7d28e36 100644 --- a/op.c +++ b/op.c @@ -1137,6 +1137,9 @@ Perl_scalarvoid(pTHX_ OP *o) else { if (ckWARN(WARN_VOID)) { useless = "a constant"; + /* the constants 0 and 1 are permitted as they are + conventionally used as dummies in constructs like + 1 while some_condition_with_side_effects; */ if (SvNIOK(sv) && (SvNV(sv) == 0.0 || SvNV(sv) == 1.0)) useless = 0; else if (SvPOK(sv)) {