home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16076 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.4 KB  |  48 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!cronkite.Central.Sun.COM!sixgun.East.Sun.COM!sungy!stasys!piano!allan
  2. From: allan@piano.sta.sub.org (Allan Brighton)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Multiple Header Files Problem
  5. Message-ID: <884@piano.stasys.UUCP>
  6. Date: 10 Nov 92 15:29:27 GMT
  7. References: <rmartin.721359424@thor>
  8. Sender: uucp@stasys.sta.sub.org
  9. Reply-To: allan@piano.sta.sub.org
  10. Organization: Brighton Software
  11. Lines: 34
  12. Nntp-Posting-Host: piano
  13.  
  14. In article 721359424@thor, rmartin@thor.Rational.COM (Bob Martin) writes:
  15. >A more interesting variation on this issue is the problem of "circular
  16. >inclusion".  Consider a source file: "a.h" which includes "b.h".
  17. >However, "b.h" includes "a.h".  This trivial example will fail to
  18. >compile.  Unless the compiler is very clever (I haven't seen one yet),
  19. >it will sit and spin until it exhauses some resouce (usually memory),
  20. >and then it will die a horrible death.  If it prints an error at all,
  21. >the error is nearly certain to have nothing to do with the circular
  22. >containment.
  23. >
  24.  
  25. Am I missing something here ?  I thought everyone puts #ifdefs at the
  26. top of each .h file like this:
  27.  
  28. #ifndef _A_H_
  29. #define _A_H_
  30.  
  31. #include <b.h>
  32.  
  33. class a {
  34. ..
  35. };
  36.  
  37. #endif /* _A_H_ */
  38.  
  39. In this case, I don't see a problem with circular inclusion.
  40.  
  41.  
  42.  
  43.  
  44. ---
  45.  
  46.                 --Allan Brighton
  47.                   allan@piano.sta.sub.org
  48.