This is the mail archive of the gdb-patches@sourceware.org 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: [obv] Make 'disable_display' static.


>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

Eli>   . why is it a good idea to go hunting for functions not used outside
Eli>     its source file and make them static?  I don't see this
Eli>     requirement in any coding standards document pertinent to GDB.

I don't hunt for these but I sometimes trip across them by accident.

Eli>   . if this is NOT mandated by any coding standards we try to enforce,
Eli>     why is this an "obvious" patch?

In general the less scope an object has, the simpler it is to reason
about it.  The "static" indicates immediately that it is private to the
file.

Eli> The reason I'm asking is that, in general, whoever wrote that function
Eli> could have judged it to be generally useful and export-worthy.

It's trivial to re-export an object should the need arise.

In fact I think it is better to have the discussion around exporting
objects than around making them static.  The default ought to be static,
as much as possible, to reduce the size of a module's API.

Tom


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