git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Frank Li <lznuaa@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: possible code error at run_command.c
Date: Mon, 21 Dec 2009 08:43:35 +0100	[thread overview]
Message-ID: <4B2F2727.4060405@viscovery.net> (raw)
In-Reply-To: <1976ea660912202329x42f6add3j9175867e8723a4bd@mail.gmail.com>

Frank Li schrieb:
>> 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.
>>
> 
> This error is captured at MSVC environment by run time varible check.

Disable this check - it just takes away performance. :-)

(If you don't disable the check, then keep the required changes private.)

> I prefer change it to
> int failed_errno = errno;

You don't need to initialize the variable at all because it is always
initialized elsewhere before it is used. Perhaps MSVC is clever enough to
see it?

-- Hannes

  reply	other threads:[~2009-12-21  7:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-21  6:46 possible code error at run_command.c Frank Li
2009-12-21  7:09 ` Wincent Colaiuta
2009-12-21  7:18 ` Johannes Sixt
2009-12-21  7:29   ` Frank Li
2009-12-21  7:43     ` Johannes Sixt [this message]
2009-12-21  8:18       ` Frank Li
2009-12-21  8:30         ` Johannes Sixt
2009-12-21  8:41           ` Erik Faye-Lund
2009-12-21  8:52             ` Johannes Sixt
2009-12-21  9:08               ` Erik Faye-Lund
2009-12-21  9:13               ` Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B2F2727.4060405@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=lznuaa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).