How can I increase the size of my executable?

without slowing down my program or otherwise changing its overall flow. I don't want to turn it into a webbrowser etc, just increase the overall size a little bit, just to brag, alright? sue me?

what library header files, or program snippets can I add to my c++ code?

uhhh... what? You're strange... just include all the header files...
char array[10*1024*1024]={0,1};
Will increase the size by 10 MiB without adding any value. I'm not sure if that behavior is standard or not, though. It works on MinGW, anyway.

PS: The real trick is not to make larger executables. It's to make more complex programs fit into smaller executables. Do you know about the demo scene? There's people who can code physics simulators into 4 K binaries. The magic of Assembly, self modifying code, and compression algorithms.
Last edited on
Bragging rights decrease as executable size increases.
well what i mean is, if i can write a program thats 10mb long, people will think that it must be more complex than it actually is.
The longest program I've written is around 17 thousand lines long and took me six months. It's 1.2 MiB when compiled for release, and that's counting two 128 KiB Shift JIS-Unicode conversion tables.
You'd have to be pretty darn fast to fill 10 MiB with code.
Last edited on
Well if OP is that naive, just throw in a few boost template instantiations (lambda or spirit are good ones) and compile with full debugging symbols. That'll make a 10MB executable real fast.
You can make your executable look like it's bigger. And it will be bigger for your OS.
You just have to use some program that changes that part of the executable binary that represents it's size.
But you'll have to look for such program, because I don't remember the name.
Anyway, if you start to copy or send that, the size doesn't matter. If your exe's genuine size is 1MB, and you make it look like 500MB, it'll send it as it is 1MB.
But I'm not really 100% sure about that, though...

Hope that helps.
ok I had been using the char array[10*1024*1024]={0,1}; code as suggested by helios and it was worked fine until today.

today when I go to compile a program i get a runtime error: "The exception unknown software exception (0xc00000fd) occurred in the application at location 0x0040d1bb."

I can still get it to compile, and if I change the amounts to smaller amounts like
char array[6*405*850] = {0, 1}; it will still run, but it will only add about a megabyte to my final program.... what is going on here?
If you don't put my statement in global scope, the array is allocated both as part of the binary at compile time and on the stack at run time, and initialized every time the program enters the function.
I'm fairly sure the stack should be immediately overflowed by an array that big.
Enzyte.... wait are we really talking about programming?
Last edited on
Topic archived. No new replies allowed.