This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Remove unnecessary zero-initializations


Andrew Cagney writes:
 > > Currently, thirteen files which provide a target_ops explicitly initialize
 > > members they don't support to NULL.  I plan to delete a number of these
 > > methods, and rather than making sure I got all the necessary target files
 > > each time I just wanted to delete the unnecessary lines up-front.  All of
 > > these are called-once functions initializing a statically or globally
 > > declared object; C will guarantee zero-initialization for us.  And several
 > > of the functions explicitly called memset anyway.
 > > 
 > > Besides, this way grepping for .to_require_attach\ = will only find targets
 > > which define it to something useful.
 > > 
 > > I'll commit this tomorrow unless someone sees a problem with it.
 > > 
 > > Note1: remote-st.c hasn't been compilable in a while; m68*-tandem-* is
 > > probably a good candidate for the hitlist.  From a glance it looks like it
 > > has been broken since the HP merge added the NULL assignments I'm removing,
 > > which is about three years now I think.
 > > 
 > > Note2: The DONT_USE member of struct target_ops can go now.
 > 
 > The fact that 13 files were doing it should suggest that it was 
 > intentional.  Might want to wait a bit longer while someone dregs up the 
 > history.
 > 
 > Andrew
 > 

I remember a debate about this when the HP merge happened. Basically
the initializations were deemed unnecessary, but they were already in,
and nobody went back to clean them up. I agree with Felix that it
would help with readability if it were done consistently, but it is
not, so probably it makes things worse. 

Elena


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]