Including header and accessing classes' effect on release exe’s performance and size in VC6

I want some guidance on how to set up my classes to optimize my program’s speed and size.  I don’t really care about compile time.

My program has alot of large classes with large header files and most new classes I make need one or two functions from at least a dozen of the large classes.  
They are usually the same functions needed across the project.

For example:

class CMyApp : public CWinApp
{
public:
  CString TempDirectory();
…(Tons of other functions)
}

A crapload of other classes need that TempDirectory() function, will it hurt the program’s performance to have “#include “MyApp.h” all over the place?

Should I add some intermediate files to provide access to these common functions?

For example:

Directories.h:
CString TempDirectory();
…(a few other common functions)

Directories.cpp:
“#include “MyApp.h”
CString TempDirectory(){
      return (CMyApp*)AfxGetApp()->TempDirectory();
}
Then just include “Directories.h” everywhere.

Any suggestions and explanations would be appreciated; the project is becoming a mess of header files.
bigsteve87Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
>>A crapload of other classes need that TempDirectory() function, will it hurt the program’s performance to
>>have “#include “MyApp.h” all over the place?

I don't see a reason to do so:

CMyApp* pApp = (CMyApp*) AfxGetApp();

CString strDir = pApp->TempDirectory();
bigsteve87Author Commented:
That was one example, but there are alot of other similar cases.

If I use CMyApp* pApp = (CMyApp*) AfxGetApp(); in a class that does not have “#include “MyApp.h” in the cpp file, I get an error because it does not recognize the class CMyApp.
AlexFMCommented:
>> Will it hurt the program’s performance to have “#include “MyApp.h” all over the place?

No.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

bigsteve87Author Commented:
Ok, good.

So the compiler should ignore the functions that are not used?
AlexFMCommented:
This has minimal impact on compilation time, but doesn't affect runtime. Assembly code generated by compiler contains only call this this specific function, nothing else.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AlexFMCommented:
For example, every Windows application has line:
include <windows.h>
which contains thousands of Windows API. Compiler needs some time to scan this file, but executable module contains only calls to API which are actually used, and not to possible Windows API.
bigsteve87Author Commented:
Thanks.  I wanted to make sure that I wasn't unnecessarily bloating my program.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.