Get the latest tech news
Working with jumbo/unity builds in C/C++
There’s been a lot of talk in recent years about something called a “jumbo build” or “unity build” or sometimes “single translation unit build”. Essentially it’s an alternate way of compiling C/C++ by putting all of the code (headers and source both) into a single file. Some people love them. Some people think they’re evil. I’ve been using them in my personal projects for a while now and thought I’d share my experiences.
Another trouble with this system is that, in larger projects, it takes time to parse all of the source and header files and then link them together. Either be mindful of the order (which isn’t too terrible), or place the module’s external definitions into a header file and include all of them in all.c at the top. This is unlikely to be much of an issue on most machines, but a sufficiently large project could consume a lot of RAM as all of the source is loaded into memory.
Or read this on Hacker News