On 10 August 2012 at 16:18 "ch...@chriswareham.net" <ch...@chriswareham.net>
wrote:
> On 10 August 2012 at 15:09 Marc Balmer <m...@msys.ch> wrote:>
> >
> > Why do you make all functions static? This way, the debugger will no longer
> > show the function names e.g. in a backtrace, iirc.
> >
>
> The reason I make functions static is that it clearly marks them as not being
> part of an API.
>
Just to expand on this, by default C functions have external linkage and can be
called from other translation units with just an extern declaration. This can
become a pain in larger codebases, where a modification to what looks ostensibly
like an "internal" function impacts code in other translation units. Because of
the implicit external linkage, if the other translation units have already been
compiled then they wont be recompiled because the dependency isn't explicit
through the function being declared in a header and included in the other
translation units. Tools like makdepend (which is in the CDE codebase) can track
the header inclusions but not extern declarations. In other words, it means a
static declaration means a programmer can optimise the function knowing it is
only called from within the current translation unit.
Regards,
Chris
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel