perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: -Wdeclaration-after-statement Final version
Date Tue, 23 Aug 2005 15:48:06 GMT


Andy_Bach@wiwb.uscourts.gov wrote:
>>>Isn't "return;" the more canonical way of returning false ?
>>
>>Beats me... I know a lot of the mp2 code particular Apache2::Status as I 
> 
> 
> was just digging in there uses return 0.  I really have no preference.
> 
> Just a note, the new "Perl Best Practices" Damian Conway, suggest a bare 
> return is best.  In particular
> return undef;
> is a bad idea as it'll slip an undef  into list context (so for zero too?) 
> which, he shows, can be problematic.

right - bare return() understands its context and will dtrt when the calling
function expects a list or a scalar, provided you mean to return simply
"false"...

is "false" what we're after here, or an actual 0 value.  false might run
into warnings issues if we try to compare the result in numeric comparisons,
while 0 will not...

--Geoff

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message