All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [RFC PATCH 1/2] Replace memset(0) with static initialization where possible
Date: Thu, 9 Oct 2008 12:17:27 -0700	[thread overview]
Message-ID: <20081009191727.GY8203@spearce.org> (raw)
In-Reply-To: <NveF6_7LIvvEmRZEvLeTO5lw7EzzmOQkz1WGEMYGSFKDWqSwAeLwBw@cipher.nrlssc.navy.mil>

Brandon Casey <casey@nrlssc.navy.mil> wrote:
> Is there interest in a patch like this?

I think this is not a worthwhile change.
 
> "Possible" benefits:
> 
>   1) more concise, so it improves readability in most cases

I'm not sure.

Maybe I'm just too used to reading memset(&foo, 0, sizeof(foo)),
but {{0},} seems very difficult to read.

>   2) gives compiler more flexibility when optimizing

Shouldn't a good C compiler notice something like a memset and inline
it when possible?  They already can inline strlen on a constant.

> Drawbacks:
> 
>   1) many lines touched for no functional change

That's a pretty big drawback.

What happens when a struct gets a struct as its first member?
Do all the {0,} inits for it have to change to {{0,},} ?

-- 
Shawn.

  reply	other threads:[~2008-10-09 19:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09 19:09 [RFC PATCH 1/2] Replace memset(0) with static initialization where possible Brandon Casey
2008-10-09 19:17 ` Shawn O. Pearce [this message]
2008-10-09 20:30   ` Brandon Casey
2008-10-09 19:47 ` Nicolas Pitre
2008-10-09 20:56   ` Brandon Casey
2008-10-09 21:12     ` Nicolas Pitre

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=20081009191727.GY8203@spearce.org \
    --to=spearce@spearce.org \
    --cc=casey@nrlssc.navy.mil \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.