Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Chabba-Wabba

Modules, or one big CPP.

This topic is 6931 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone know if it''d be better (read, more optimised) if, in the final build... instead of building lots of object files having them linked together, have one big CPP include file which includes all the CPP files... ??

Share this post


Link to post
Share on other sites
Advertisement
You probably aren''t going to get any performance increase by doing something like this because, for the most part, code in one module is going to be independent of code in another module. The compiler is not going to be able to do any added optimizations.

Although it isn''t COMPLETELY accurate, the linker essentially is globbing all your object code together anyway, so you don''t gain much, if anything, by including all the files in one.

Plus, doing this could turn into something of a nightmare to maintain. It is similar to having all of your code in one giant CPP file. The reason that the ''normal'' way of doing things is to break these files apart is so that they are easier to manage.

Share this post


Link to post
Share on other sites
The more separate files you use, the quicker your compile times are gonna be, as you only ever need to recompile files that change.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''m not an expert, but the optimizations you can gain from having everything in one file as opposed to many different modules can be simulated by specifying code segments to compile stuff into using preprocessor directives. For a good example of this, take a look at some of the MFC source files.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!