Re: Coding style survey

From: Severian (severian_at_chlamydia-is-not-a-flower.com)
Date: 01/28/04


Date: Wed, 28 Jan 2004 15:32:52 GMT

On Tue, 27 Jan 2004 22:57:04 -0000, "Malcolm"
<malcolm@55bank.freeserve.co.uk> wrote:

>
>"Richard Bos" <rlb@hoekstra-uitgeverij.nl> wrote in message
>> > c), return is not a function. Though you want to ask why you are
>> > returning the return value from another function directly - this is
>> > unusual.
>>
>> Not at all. The function containing the return statement could be a
>> function which prepares the data for foo().
>>
>So there are exceptions. As a rule of thumb, however, if a function calls
>another function that returns a value, then the caller is the appropriate
>level to process that value - not simply to return it to a higher level.
>If you need to prepare data for foo() then that would be an indication that
>foo() is badly written. Just an indication, mind you, there might be some
>cases where the problems of formatting input neatly are so deep-rooted that
>foo() needs a setup function.

Bull***. There are many useful and valid reasons to return foo().

>My recent MiniBasic program was over 3000 lines. I don't think there is a
>single case of returning a sub-function's value directly in all that code.

My current application is over 1,000,000 lines. And there are quite a
few functions that return foo(), for various reasons (some elegant,
some for readability, and some just old and gnarly). So there!

- Sev