lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Dirk Laurie once stated:
> 2014-03-17 0:26 GMT+02:00 Sean Conner <sean@conman.org>:
> 
> >         But another, lesser known
> >         (or quite possibly it's just me) flaw are function prototypes for
> >         static functions.  Why do I need them?  This isn't 1970 anymore.  We
> >         don't have to strive for a one-or-two-pass compiler anymore.  Just
> >         scan ahead looking for static functions, then do a second pass for
> >         the compilation step.  How hard is this?  Sheesh.
> 
> One is so used to having prototypes for external functions that needing
> them in the special situation where the references among static functions
> would create a loop does not bother me. But anyway, when starting on
> a new project, I like to write the prototypes before I write the bodies.
> All of them. Gives me a comforting if misleading feeling that I have
> a well-designed project and have already achieved some productivity.

  Strictly speaking, you don't need prototypes for static functions if you
define the code bottom up (functions defined before use) or they just return
an int (default return type of functions).  But I like to write C in a
top-down style, so I have to use prototypes.  And I tend to write the
protypes last, after the code is written.

  -spc