🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3457

Re: #ifdef XXXX

#3457
From: John R. Williams
Date: Thu, 15 Feb 1996 12:07
35 lines
2368 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 suppose the idea is that the compiler builds a table (like gcc does for
> wrapped includes) - pretty simple really.

> Ideas about why this won't work ???

Personally I'll continue to advocate "#once" to prevent multiple 
inclusion of a header for these reasons:

  Although it adds no new capability to the language, it would be trivial 
  to implement and to specify in a standard. The benefit it that it
  prevents programmers from having to do a little of the kind of mindless
  robotic work that computers do so much better than humans.

  I don't like Bjarne's idea because I would think that the writer of
  any given header knows more about how many times it should be included
  than the user. If it *does* need to be multi-included, it is reasonable
  to expect to the programmer would forget to use the traditional include
  mechanism alarmingly often. C++ already has enough things like this that
  silently cause strange errors when the programmer forgets something
  (like everyone's favorite, the switch statement). Conversely, many would 
  countinue to use the old mechanism, which would not work too well, while 
  #once is 100% backwards compatible.

--
#define REAL_NAME "John Williams"
#define E_MAIL    "johnw@jove.acs.unt.edu"
#define HOMEPAGE  "http://www.unt.edu/~johnw"
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  Moderation policy:
  http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Technical Details
Message-ID: <4fukhs$fc3@hermes.acs.unt.edu>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <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
From: johnw@jove.acs.unt.edu (John R. Williams)
Message-ID: <4fukhs$fc3@hermes.acs.unt.edu>
X-Original-Date: 15 Feb 1996 06:41:00 GMT
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 15 Feb 96 12:07:00 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: #ifdef XXXX
Organization: University of North Texas
References: <1996Feb1.092058.4745@iiasa.ac.at> <9602020740.22411@mulga.cs.mu.OZ.AU> <9602141406.AA16760@sparc5.ferndown.ate.slb.com>
X-Newsreader: TIN [version 1.2 PL2]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMSMiseEDnX0m9pzZAQFAoQF9F2FNpYF7NxT960qJNX1bKNa5ZlHcQWSh
 Yc8F2Q8v0F0SnWEDjlzqC7u+5J40ePdS
 =HrhA