Why is the code generated for the “Hello world” program ten times larger for C++ than for C?
It isn’t on my machine, and it shouldn’t be on yours. I have even seen the C++ version of the “hello world” program smaller than the C version. In 2004, I tested using gcc -o2 on a Unix and the two versions (iostreams and stdio) yielded identical sizes. There is no language reason why the one version should be larger than the other. It is all an issue on how an implementor organizes the standard libraries (e.g. static linking vs. dynamic linking, locale support by default vs. locale support enabled through and option, etc.). If one version is significantly larger than the other, report the problem to the implementor of the larger.