This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: PATCH: Remove unnecessary zero-initializations
- From: Felix Lee <bdgle at tigerfood dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 11 Nov 2002 13:16:40 -0800
- Subject: Re: PATCH: Remove unnecessary zero-initializations
Daniel Jacobowitz <drow@mvista.com>:
> 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.
Of course. It's not about writing the target in the first
place, it's about reading it and maintaining it later. Say,
a year from now, someone adds a new method but doesn't spend
all the effort necessary to make all N targets work
correctly with the change, which is reasonable since it's
not sensible to insist that everyone be familiar with the
issues of all N targets before doing any work.
Absence of an initializer is a simple indication that
someone should look at it and make sure it's ok. Putting in
a zero initializer is an easy sign for, "yes, this is ok".
"Always initialize all members and methods" is a simple
style rule that encourages good programming discipline in a
couple ways, and if I were in charge I'd be adding all the
missing zero initializers rather than taking away the
existing ones :)
I'm not sure why you call it "an awkward style issue". If a
block of initializers seems long, it's because an interface
is complicated, and glossing over that by making the
initialization look simpler is counter-productive. The
correct point to attack is the interface itself, not the
places it's used.
--