Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!indri!larry!jwp From: jwp@larry.sal.wisc.edu (Jeffrey W Percival) Newsgroups: comp.lang.c Subject: declarations in include files: how do YOU feel? Keywords: declarations include Message-ID: <179@larry.sal.wisc.edu> Date: 10 May 89 21:42:25 GMT Organization: Space Astronomy Lab, Madison WI Lines: 23 I would like to find out how the "experts" feel about a coding practice, so I don't develop a bizarre style (bizarre with respect to the general body of usage). I hope this doesn't start a philosophy war of some kind. The situation is, suppose I have a bunch of routines that are packaged into a lib.a, and there is an associated include file "lib.h" that users need to include. Should the lib.h file contain extern declarations for everything in lib.a, or not? case 1: shotgun approach. declare all the routines contained in lib.a advantage: user doesn't need to. disadvantage: "scope" is not micro-managed. labels are in scope everywhere, even labels not used in actual references. case 2: "anal" approach. no declarations in lib.h. User needs to type in the declarations in every function that makes a reference. advantage (???): user sees declarations in same file as usage. scope of labels is managed according to program design. If my goal is to be portable and non-eccentric, what should I do? -- Jeff Percival (jwp@larry.sal.wisc.edu)