Newsgroups: comp.lang.c++ Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Including header files minimally. Message-ID: <1988Nov25.180309.9323@utzoo.uucp> Organization: U of Toronto Zoology References: <3561@pt.cs.cmu.edu> <7860@nsc.nsc.com> <3614@pt.cs.cmu.edu> <10873@ulysses.homer.nj.att.com> <1073@actnyc.UUCP> <738@quintus.UUCP> Date: Fri, 25 Nov 88 18:03:09 GMT In article <738@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes: >Instead of tinkering with the definition of an existing construct, >why not do the sanitary thing and add a new one? > #use {filename} >... Easy to do, can't break old code, doesn't >require changes to the file being used. Well, leaving the existing construct alone (except perhaps in the presence of a compiler flag) is the right thing to do, but "doesn't require changes to the file being used" is a bug, not a feature. In most cases, the fact that #including a file n times is the same as including it once is a property of the file being included, not the file doing the including. The probability of trouble and mistakes will be much lower if it's the file being included that determines whether future inclusions have any effect. The Waterloo "#pragma idempotent" strikes me as the right method; among other things, it means that your code is portable. -- Sendmail is a bug, | Henry Spencer at U of Toronto Zoology not a feature. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu