questionnaire

Rick Jones rick_jones at f616.n713.fido.oz
Thu Jan 18 08:32:23 AEST 1990


Original to: phil at ux1.cso.uiuc.edu
In a message of <12 Jan 90 02:20:39>, phil at ux1.cso.uiuc.edu (3:713/603) writes:

 pA>1.  Whether or not to use "typedef" for a "struct"
 pA>    a.  how do you deal with the case of two different struct types
 pA>        having pointers to the other type?

Depends on the program.  I quite often use typedef struct to define structures
so that I may then reference them by their new type.

 pA>2.  When you decide to separate structures into header files
 pA>    a.  how big must the program be to warrant this?
 pA>    b.  do you always do so?
 pA>    c.  never?

d.  Whenever there is a reasonable chance that the same structures will be used
in two or more programs/modules.

 pA>3.  Making functions used (in many places) only by your program extern
 pA>    a.  what if only one program calls this function?

Same as above.  if the function is useful enough to be <maybe> used in more
than one program/module, it finds its way into the library.

 pA>4.  Do you consider passing a "pointer to a function" to another 
 pA>function
 pA>    which will (blindly?) use it to call that function, a "kosher"
 pA>    programming practice?

I don't know about blindly, but yes I have quite a few programs that do that.
particularly my format() module that does all the work for printf, fprintf,
lprintf, etc.  is called with the pointer to an output function, allowing one
function to perform multiple roles.

Rick.


--- msged 1.99S ZTC
 * Origin: /\/\onitor \/\/orld, Sydney 'Where you can C forever...' (3:713/616)



More information about the Comp.lang.c mailing list