Re: [PATCH 4/6] Add explict return to end of subroutines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 29, 2009 at 09:12:21AM -0400, Bill Pemberton wrote:

> In perl a subroutine that ends without an explicit return will return
> the value of the last expression evalutated.  This can lead to
> unexpected return values.

I am not opposed to this, but it is really not helping anything. These
functions aren't meant to return any value, and their return values are
not used. In C, they would simply be declared "void", but there is no
way (AFAIK) to do that in perl.

But for some of them, I wonder if you would do better instead of
returning _nothing_ to return something that might make a little bit of
sense. For example, make_message_id munges a global variable. A
useful refactoring might be to have it return the value of the
global variable, and then perhaps even the global could go away, which
_would_ be a real improvement.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]