Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: C Function Prototype Generator

2011-01-20 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, "Chuck Hackett" <egroupscdh@...> wrote:
> To those of you that use a C Function Prototype Generator to
> automatically generate function prototypes from C source files:  
In 30+ years of C/C++ programming, I've never used one.  In my estimation they are a solution seeking a problem.  If you're using source code from another party it should already have the necessary prototypes defined.  If you're creating your own source code just copy the type, name and parameter list lines and paste them in the appropriate include file or near the top of the source file depending on whether the particular function if public or private.  Job done.

As an asice, I generally define my functions in this form:

func-type
func-name(parameter-list)
{
    func-statement
}

for example,

uint8_t
foo(uint16_t *bar)
{
}

The key aspect of this (unconventional) format is that it makes it simple in many/most text editors to locate the definition of the function (as opposed to its use).  Assuming the editor provides the functionality of searching for a regular expression over a set of files, the regex ^foo\( will locate the place where the function foo is defined.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.