Re: [Audacity-devel] Patch: 'static' for local vars/functions
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Richard A. <ri...@au...> - 2013-09-21 19:39:53
|
On Sun, 15 Sep 2013 16:08:13 +1000 Campbell Barton <ide...@gm...> wrote: > Use static for vars functions when local to a file. > > Quiets warnings with '-Wmissing-prototypes -Wmissing-declarations' and > ensures that source files include own headers and that the > declarations match the definitions. > > http://www.graphicall.org/ftp/ideasman42/audacity_static_r12559.diff This is a bit of a mixture which I've had to spilt into several commits in order to give it sensible commit messages. Most of it has gone into two categories: * global scope variables that can become static so they have file scope. * member functions which do not access member variables, so can become static functions which don't require an object to call In both cases I wonder if the code really has better long-term solutions which would be more OO and so more robust. In the first case, I wonder if the globals should either be object variables (some of them probably could be, e.g. for singleton objects) or class constants (where we currently have static const variables). In the second, several of these member functions are close to duplicate and could be collected as utility static functions in a central class (as the TODO comments indicate!). Patches aimed at either of these would be welcome - preferable in sets which do one thing (one kind of thing) to the source, so they can be easily reviewed and applied. Finally, there is the todB_a() function, which in view of the fact it isn't called, and looks like a liability, I have removed completely. Richard |