-
Two questions
1. If I have these headers:
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
#inclue <stdlib.h>
will this make my .exe file huge? I included these and compiled it in release mode optimized for size and it is 152 kb or some such.
2. Is there a way to input a string in C (not C++) with spaces in it?
-
1. Including the string template brings a large proportion of the iostreams code in as well. I don't think stdlib.h has much effect though. Set your linker options to emit a map file and then look at that in WordPad.
2. scanf?
-
What am I looking for? The mapfile is 247 kb.
-
Zip & Attach it and I'll give you a mini-analysis :)
-
1 Attachment(s)
Btw, scanf doesn't work, but gets does.
-
OK. It's included all the locale-handling code which basically brought the ENTIRE IOStream library in. It's all referenced in the mapfile (mangled names :eek:)
-
I rewrote it using C functions and the release-mode optimized-for-size .exe turned out to be 36 kb. Why are C++ .exe's so much bigger than ones in C?
-
C++ has a lot more overhead with certain things. For example, IOStreams is a whole library, whereas C just has struct FILE pointers, and raw file handles.