With VisualAge C++, Version 4.0, you can avoid mundane programming tasks such as:
With VisualAge C++, Version 4.0, you can organize source code into files in any order. VisualAge C++ has orderless parsing, which means that the computer (not you!) sorts the declarations. VisualAge C++ also takes care of header files. Typically, header files require you to use various mechanisms to sort declarations for the compiler. (For more information on orderless programming, see Code Development.)
To realize how much productivity you will gain by letting VisualAge C++ do the work for you, take a look at a simple example that has a main() function and two classes, A and B, organized into files in this manner:
| File A.h | File B.h | File main.cpp |
#ifndef A_H
#define A_H
#include "B.h"
class A : public B
{
public:
B* f() {return new B;}
};
#endif
|
#ifndef B_H
#define B_H
#include "A.h"
class B
{
public:
A* g() {return new A;}
};
#endif
|
#include "B.h" int main()
{
B b;
return 0;
}
|
The above code follows the standard method for organizing header files. Even this simple code will not compile when organized in this way. (Trace by hand the macro processing to see why.) To fix the code, you have to add forward declarations (for example, class A in B.h), and move the inline function definitions into separate files. But this is a tedious process, even for this simple example, and becomes a coding nightmare in a large project.
With VisualAge C++, you can organize your code in this way:
| File A.h | File B.h | File main.cpp |
class A : public B
{
public:
B* f() {return new B;}
};
|
class B
{
public:
A* g() {return new A;}
};
|
int main()
{
B b;
return 0;
}
|
Or, if you prefer, you can put all of the code in a single file in whatever order makes sense to you:
| File main.cpp |
class A : public B
{
public:
B* f() {return new B;}
};
class B
{
public:
A* g() {return new A;}
};
int main()
{
B b;
return 0;
}
|
Notice that there are no forward declarations, macro guards, or #include statements. VisualAge C++ eliminates the need for such tedious programming practices by maintaining a codestore database for your program, and by replacing makefiles with a configuration file that defines, among other things, the source and header files needed to compile your project.
