Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!gatech!hubcap!rwberry From: rwberry@hubcap.clemson.edu (Robert W Berry) Newsgroups: comp.lang.c Subject: Re: declarations in include files: how do YOU feel? Message-ID: <5450@hubcap.clemson.edu> Date: 11 May 89 07:12:11 GMT References: <11318@bloom-beacon.MIT.EDU> Sender: news@hubcap.clemson.edu Organization: Clemson University, Clemson, SC Lines: 34 From article <11318@bloom-beacon.MIT.EDU>, by scs@sloth.pika.mit.edu (Steve Summit): > In article <179@larry.sal.wisc.edu> jwp@larry.sal.wisc.edu (Jeffrey W Percival) writes: ... include variable declarations in header file? ... > > By all means. I'd say that this is the recommended standard > practice. If you're using ANSI-style function prototypes, put > the prototypes in too, of course. If you're not using > prototypes, you may leave out extern declarations for those > functions returning int. (You may also leave them in, for > documentation purposes.) Is it? I thought the more general practice was to define the variable types (structures, unions, etc.) and have the programmer declare a variable of the appropriate type for use in his function. Look at file pointers (of type FILE *) that you declare for stream I/O, low-level structures (such as REGS in Turbo C), windowing libraries often have a structure called "window" that is manipulated by the library rountines. I definitely vote yes on having prototypes in the header file (if you're into prototypes that is). But declaring variables there scares me a little. (And there's always the nasty possibity of duplicating a variable name -- although this already happens with certain structure names in header files.) Bob -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- Bob Berry -=- PC-Guru's Inc. ! rwberry@hubcap.clemson.edu -=- -=- We are the science of modern motion. ! 803-654-7623 || 803-656-2635 -=- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-