On Wed, Nov 12, 2014 at 2:59 AM, Jeff King <p...@peff.net> wrote:
>>
>> I do not mind much either way. But I doubt that a single extra struct on
>> the stack will break the bank, compared to the fact that we are forking
>> and execing a new program. I'd also not be surprised if a smart compiler
>> could notice that the variables are used exclusively in non-overlapping
>> bits of the code, and just reuse the stack space.
>
> Actually, I take that back. We are passing a pointer to a struct, rather
> than by-value, so the compiler cannot know that the sub-function does
> not store that pointer in a static variable, and reference it in the
> next call. It must use two variables if it cannot see the definition of
> run_command.
>
> I still think it's pointless optimization to worry about, and you should
> write whichever is the most readable and maintainable.

Amen.  I do not have strong preference either way as long as the result
is readable, correct and maintainlable ;-).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to