Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: Fundamental Types Up: Coding Fundamentals Previous: Compilers

Include Files

All files should should ensure that <aips/aips.h> is included in their source file. It currently makes sure the following are properly defined:

1.
#pragmas that are required for the TI preprocessor (presently used to implement templates ([*]) and run time type identification ([*]).
2.
It will make some portability adjustments and ensure that fundamental types ([*]) are available.
3.
Ensure that the namespace management ([*]) is turned on.
4.
And any other miscellaneous things that are required to ensure that programmers can see a common environment.

Some other include files that are of general note are:

The strategy for including files is very important. Every file which is #include'd in your .h file will normally 3.2 be opened and read in turn as your header file is scanned, even if you have protected your header file ([*]). This can greatly increase your compilation time. Instead of #include in your header files, you should instead forward declare all the classes you need, and then do the # include in your source (".C") file. The only times you might want to violate this rule of thumb is when the classes you are defining in your header file will always or almost always be used with another set of classes, then for convenience you might want to package them together this way. You might also be conservative and always include aips/aips.h.

So, instead of:

#include <aips/Foo.h>

class Bar
{
   Foo doit();
};

We would have:

class Foo; // Forward

class Bar
{
   Foo doit();
};


next up previous contents index
Next: Fundamental Types Up: Coding Fundamentals Previous: Compilers   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15