From: Daniel Jacobowitz <drow@mvista.com>
To: Felix Lee <bdgle@tigerfood.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: PATCH: Remove unnecessary zero-initializations
Date: Mon, 11 Nov 2002 06:33:00 -0000 [thread overview]
Message-ID: <20021111143426.GA26740@nevyn.them.org> (raw)
In-Reply-To: <200211111048.gABAmXr01641@paper-wolf-solo.tigerfood.org>
On Mon, Nov 11, 2002 at 02:48:33AM -0800, Felix Lee wrote:
> Daniel Jacobowitz <drow@mvista.com>:
> > Currently, thirteen files which provide a target_ops explicitly initialize
> > members they don't support to NULL.
>
> this is a style and readability issue. if every set of
> initializations is complete and mentions all members, even
> when "unnecessary", then it's easier to quickly check that
> an implementation correctly matches the specification. a
> statement like
> foo.bar = 0;
> indicates that the programmer was aware that foo.bar exists,
> thought about it, and decided that 0 is a correct value.
>
> if the statement is missing, you have to spend time deciding
> if the programmer omitted it accidentally or not.
>
> a different technique is to put a note in a comment instead
> of as a statement:
> // foo.bar can be 0
> but this is a pointless micro-optimization, it's an
> optimization a compiler could be taught how to do, and you
> lose the opportunity to have an automated tool check for you
> that initializations are complete.
Certainly it's a style issue. However, it's an awkward style issue and
anyone implementing a target should be looking over the complete list
of methods anyway. I stand by my patch... although perhaps not as
"obvious" after two objections.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2002-11-11 14:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-10 16:18 Daniel Jacobowitz
2002-11-10 20:09 ` Andrew Cagney
2002-11-10 20:22 ` Daniel Jacobowitz
2002-12-19 15:51 ` Elena Zannoni
2002-12-19 15:59 ` Daniel Jacobowitz
2002-11-11 6:39 ` Elena Zannoni
2002-11-13 10:59 ` Michael Snyder
2002-11-13 11:32 ` Andrew Cagney
2002-11-13 11:50 ` Michael Snyder
2002-11-11 2:48 ` Felix Lee
2002-11-11 6:33 ` Daniel Jacobowitz [this message]
2002-11-11 17:15 ` Felix Lee
2002-11-12 13:44 ` Daniel Jacobowitz
2002-11-13 11:04 ` Michael Snyder
2002-11-13 11:38 ` Stan Shebs
2002-11-13 11:01 ` Michael Snyder
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=20021111143426.GA26740@nevyn.them.org \
--to=drow@mvista.com \
--cc=bdgle@tigerfood.org \
--cc=gdb-patches@sources.redhat.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