home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!cs.utexas.edu!swrinde!emory!sol.ctr.columbia.edu!caen!uwm.edu!linac!att!cbnewsc!cbfsb!cbnewsg.cb.att.com!nh
- From: nh@cbnewsg.cb.att.com (nicholas.hounsome)
- Subject: Idempotent header file proposal
- Message-ID: <1992Nov19.090742.23696@cbfsb.cb.att.com>
- Sender: news@cbfsb.cb.att.com
- Organization: AT&T
- Date: Thu, 19 Nov 1992 09:07:42 GMT
- Lines: 31
-
- One problem with C++ is that when used properly it requires huge
- numbers of header files most of which are included multiple times.
- Of course I know that there is the crude workaround :
-
- #ifndef HEADER_H
- #define HEADER_H
-
- stuff
-
- #endif
-
- But the preprocessor still has to find, open , and read the whole file
- so it does not realy gain you any efficiency.
-
- The best available soloution is:
-
- #ifndef HEADER_H
- #include "header.h"
- #endif
-
- but this is clumsy.
-
- Can we not have a standard pragma to say that a header file is idempotent
- (A long word I discovered that means that it only need be included once).
- eg. put #pragma IDEMPOTENT in the header and have the preprocessor
- understand that it need not bother reading this file again it seems
- very easy to implement provided only that you use an ANSI preprocessor
- and it requires no language extension since it is only a convention
- which the preprocessor can ignore if it does not understand it.
-
- Nick Hounsome
-