C declaration styles

William E. Davidsen Jr davidsen at steinmetz.steinmetz.ge.com
Thu Mar 24 00:52:19 AEST 1988


In article <8695 at tut.cis.ohio-state.edu> mdf at tut.cis.ohio-state.edu.UUCP (Mark D. Freeman) writes:
| Another great idea:  make your declarations look like this...
| 
| void	foo(int x, double y)	/* DECLARATION */
| 
| and you can create quick and dirty documentation for yourself with one
| grep piped through sort, resulting in an alphabetized list of all your
| functions showing the number and types of arguments for each!  Great
| for libraries that you are writing.

A very good idea. Here are two things to look for in MSC:
 1) you can just use the -Zg option which will create the type of
    documentation you want (almost) without the names of the args.
    This file may then be included in all modules, giving type
    coersion to all calls, and type checking on the returns. I
    use this in several packages, and it works well.

 2) I have a note saying that there may be a problem when using
    float, in that "float x" expects a float as the argument,
    while "foo(x) float x; {" expects a double (as per K&R).
-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list