Re: possible code error at run_command.c
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Dec 21, 2009, 07:18 UTC
- Message-ID
- <4B2F214D.2020905@viscovery.net>
- In-Reply-To
- <1976ea660912202246k45732bf2p111bbeb78047693e@mail.gmail.com>
Frank Li schrieb:
Show 8 quoted lines
> int start_command(struct child_process *cmd)
> {
> int need_in, need_out, need_err;
> int fdin[2], fdout[2], fderr[2];
> int failed_errno = failed_errno;
>
> I have not found failed_errno as global variable.
> failed_errno = failed_errno means nothing.This is a commonly used idiom to avoid an (incorrect) compiler warning about an uninitialized variable.
Strictly speaking, I think that you are right by saying "means nothing" because the use of the uninitialized variable invokes undefined behavior (and for this reason, I dislike this construct), but in practice it will not make a difference.
-- Hannes