Article View: gnu.misc.discuss
Article #74907Including Source in Header Files
From: David J. Camp
Date: Thu, 24 Jan 1991 19:54
Date: Thu, 24 Jan 1991 19:54
34 lines
2430 bytes
2430 bytes
I have been considering an idea to include the source to library functions in the header files. The SOURCE macro would control whether the file is compiled for the library or as a header file. I am almost ready to give up on the idea, but thought I would give the net community a chance to talk me back into it. The main pro argument is that the function prototypes need not be duplicated in both the source and he header file. They can be specified using the portable.h package I have been distributing, such that the same statement both defines the function and declares the interface. There are two con arguments. One is an issue of software engineering and the other is a techical detail in the implementation. One user argued that header files should be reserved for interfaces, hiding the details of implementation from the user. That would prevent the programmer from making assumptions in his code based on the details revealed in the source. The other con argument regards the complexity of compilation. The SOURCE macro must be defined after the header file is included. If this is not done properly, then major problems could ensue. Also, the TEST variable cannot be used, because other programs using these header files would cause the library routine's test code to be generated. There is probably a workaround, at worst defining a separate PACKAGE-NAME_TEST variable for each header file. As I indicated, I have nearly given up on the idea, and will only continue the practice if I get resounding affirmation from the net. -David- # david@wubios.wustl.edu ^ Mr. David J. Camp # # david%wubios@wugate.wustl.edu < * > +1 314 382 0584 # # ...!uunet!wugate!wubios!david v "God loves material things." # # abs (investment#1 - investment#2) << abs (anyinvestment - anydebt) #
Technical Details
Message-ID:
<9101241954.AA12022@wubios.wustl.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!WUBIOS.WUSTL.EDU!davidShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1025b4,ea1e72ee52369535,start X-Google-Attributes: gid1025b4,public X-Google-ArrivalTime: 1991-01-25 00:56:25 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!WUBIOS.WUSTL.EDU!david From: david@WUBIOS.WUSTL.EDU (David J. Camp) Newsgroups: gnu.misc.discuss Subject: Including Source in Header Files Message-ID: <9101241954.AA12022@wubios.wustl.edu> Date: 24 Jan 91 19:54:16 GMT Sender: karl@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Lines: 34