Another convention: when foo.h contains fields of type pointer to BLAH, it doesn't include blah.h; instead it declares struct BLAH; at the top.
foo.h needs to include blah.h only if it contains fields of type BLAH, or otherwise needs to refer to the internals of BLAH. -- David On 30-Jul-2012 12:55 PM, [email protected] wrote: > > I agree with including headers only in the files that need them. However, > some headers need to include other headers. Specifically where Header A > uses a class or structure defined in Header B. In that case, Header A > needs to include Header B. I have been on many chases trying to figure out > why something just will not compile and discovering that the order of > header includes changed someplace which made the definition of a class > happen after its first use. So the apparent law that headers should only > be included in cpp files is a bit too strong. > > jm7 > _______________________________________________ boinc_dev mailing list [email protected] http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev To unsubscribe, visit the above URL and (near bottom of page) enter your email address.
