Article View: comp.std.c++
Article #3460Re: #ifdef XXXX
From: Micha Berger
Date: Thu, 15 Feb 1996 15:42
Date: Thu, 15 Feb 1996 15:42
46 lines
1956 bytes
1956 bytes
devitto@ferndown.ate.slb.com wrote:
: What about Bjarne's idea of "include" as a keyword that only has the effect
: of a #include if the file has not been "include"d already.
I'm okay with it as long as we leave something to mean the old
include-no-matter-what behavior.
A common trick for making an array that includes pointers to functions is
something like:
file1.h --------
func(foo);
func(bar);
file2.cc ------
#define func(x) int x(char*);
#include <file1.h>
#undef func
#define func(x) { ##x, x },
struct funcHandle {
const char* const name;
const int (* const)(char*) function;
} funcArray[] = {
#include <file1.h>
};
--------------
It may be overly clever, but I've seen this one in almost every C/C++ shop
I've worked in.
--
Micha Berger 201 916-0287 Help free Ron Arad, held by Syria 3255 days!
AishDas@haven.ios.com (16-Oct-86 - 5-Oct-95)
<a href=news:alt.religion.aishdas>Orthodox Judaism: Torah, Avodah, Chessed</a>
<a href=http://haven.ios.com/~aishdas>AishDas Society's Home Page</a>
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is
summarized in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
]
Technical Details
Message-ID:
<4fv9er$aeq@news.ios.com>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<1996Feb1.092058.4745@iiasa.ac.at> <9602020740.22411@mulga.cs.mu.OZ.AU> <9602141406.AA16760@sparc5.ferndown.ate.slb.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: aishdas@haven.ios.com (Micha Berger) Newsgroups: comp.std.c++ Subject: Re: #ifdef XXXX Date: 15 Feb 1996 15:42:52 GMT Organization: AishDas Society Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <4fv9er$aeq@news.ios.com> References: <1996Feb1.092058.4745@iiasa.ac.at> <9602020740.22411@mulga.cs.mu.OZ.AU> <9602141406.AA16760@sparc5.ferndown.ate.slb.com> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Nntp-Posting-Host: haven.ios.com X-Newsreader: TIN [version 1.2 PL2] Content-Length: 1059 X-Lines: 41 Originator: clamage@taumet