home *** CD-ROM | disk | FTP | other *** search
- 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
- From: allan@piano.sta.sub.org (Allan Brighton)
- Newsgroups: comp.lang.c++
- Subject: Re: Multiple Header Files Problem
- Message-ID: <884@piano.stasys.UUCP>
- Date: 10 Nov 92 15:29:27 GMT
- References: <rmartin.721359424@thor>
- Sender: uucp@stasys.sta.sub.org
- Reply-To: allan@piano.sta.sub.org
- Organization: Brighton Software
- Lines: 34
- Nntp-Posting-Host: piano
-
- In article 721359424@thor, rmartin@thor.Rational.COM (Bob Martin) writes:
- >A more interesting variation on this issue is the problem of "circular
- >inclusion". Consider a source file: "a.h" which includes "b.h".
- >However, "b.h" includes "a.h". This trivial example will fail to
- >compile. Unless the compiler is very clever (I haven't seen one yet),
- >it will sit and spin until it exhauses some resouce (usually memory),
- >and then it will die a horrible death. If it prints an error at all,
- >the error is nearly certain to have nothing to do with the circular
- >containment.
- >
-
- Am I missing something here ? I thought everyone puts #ifdefs at the
- top of each .h file like this:
-
- #ifndef _A_H_
- #define _A_H_
-
- #include <b.h>
-
- class a {
- ..
- };
-
- #endif /* _A_H_ */
-
- In this case, I don't see a problem with circular inclusion.
-
-
-
-
- ---
-
- --Allan Brighton
- allan@piano.sta.sub.org
-