c++ - 367KB For Hello World !!
- Yeric (11/11) Jul 29 2003 Ok I am sure someone is going to be able to tell me that there is someth...
- Greg Peet (6/7) Jul 29 2003 You have a file called "hello" containing the source? Are you using the ...
- Greg Peet (15/15) Jul 29 2003 I wrote a hello world with printf and then with iostream, using stlport ...
- Ilya Minkov (26/30) Jul 29 2003 Oh c'mon!
- Greg Peet (3/34) Jul 29 2003 Are you using the default SGI Library or STLPort?
- Yeric (8/22) Jul 30 2003 Indeed I a also using the STLPort library thanks for taking the time to
- Yeric (9/9) Aug 12 2003 Hmmm
- Ilya Minkov (9/15) Aug 12 2003 So you use IDDE. Command-line rules!
- Yeric (7/14) Aug 13 2003 Sorry I missed that one dute
- Yeric (2/5) Jul 30 2003 Ok thanks
Ok I am sure someone is going to be able to tell me that there is something else I can do here to reduce the size from 367KB. I compiled dmc hello -o+space & dmc hello -o both file sizes were almost the same, the -o+space was slightly higher by a few bytes. I know in GCC you can pass -s to the linker to strip symbols to reduce the exe, is there something similar in dmc or is 367KB the best I can hope for in a 5 line console ?? I am not overly bothered size isnt everything <g> as I discovered a slightly larger program 10 lines does not increase excessivley over the 367KB Any ideas please ?
Jul 29 2003
"Yeric" <REMOVEamigabloke yahoo.co.ukREMOVE> wrote in message news:bg6lka$2e0g$1 digitaldaemon.com...I compiled dmc hello -o+space & dmc hello -oYou have a file called "hello" containing the source? Are you using the C runtime or C++ iostream for output? If it's C++, you have your answer...the implementation. I still have not found a mildly-sized C++ iostream. Use printf instead.
Jul 29 2003
I wrote a hello world with printf and then with iostream, using stlport and dmc 8.35: printf: 38 KB cout: 366 KB You can try the printf/cout test with most compilers, and I guarantee that you will mostly get higher footprints for the iostream use. Bjarne Stroustrup says (in The C++ Programming Language), that this is a misconception and it's all based on your library provider. Well, I've used a lot of different compilers/libraries and always have seen the same thing. Think about printf/scanf over the cout/cin family. -- Regards, Gregory Peet Fellow Digital Martian STLSoft FAQ: http://stlsoft.gregpeet.com
Jul 29 2003
Greg Peet wrote:I wrote a hello world with printf and then with iostream, usingstlport anddmc 8.35: printf: 38 KB cout: 366 KBOh c'mon! I used the STL included with DMC. dmc hello.cpp -Nc -6 -o With my stubborn Hello program, result: .exe 48156 bytes .obj 829 bytes With a standard hello world: .exe 47132 bytes .obj 376 bytes Stubborn Hello Source: --- 8< --- #include <iostream.h> int main (int argc, char *argv[]) { char quit = '\0'; while (quit != 'q') { cout << "Hello ! This is a very simple but stubborn console app." << endl; cout << "\tPress q to quit " << endl; cin >> quit; } return 0; } --- >8 --- -i.
Jul 29 2003
Are you using the default SGI Library or STLPort? "Ilya Minkov" <midiclub 8ung.at> wrote in message news:bg6upt$2n5b$1 digitaldaemon.com...Greg Peet wrote: > I wrote a hello world with printf and then with iostream, using stlport and > dmc 8.35: > > printf: 38 KB > cout: 366 KB Oh c'mon! I used the STL included with DMC. dmc hello.cpp -Nc -6 -o With my stubborn Hello program, result: .exe 48156 bytes .obj 829 bytes With a standard hello world: .exe 47132 bytes .obj 376 bytes Stubborn Hello Source: --- 8< --- #include <iostream.h> int main (int argc, char *argv[]) { char quit = '\0'; while (quit != 'q') { cout << "Hello ! This is a very simple but stubborn console app." << endl; cout << "\tPress q to quit " << endl; cin >> quit; } return 0; } --- >8 --- -i.
Jul 29 2003
I wrote a hello world with printf and then with iostream, using stlportanddmc 8.35: printf: 38 KB cout: 366 KB You can try the printf/cout test with most compilers, and I guarantee that you will mostly get higher footprints for the iostream use. Bjarne Stroustrup says (in The C++ Programming Language), that this is a misconception and it's all based on your library provider. Well, I've usedalot of different compilers/libraries and always have seen the same thing. Think about printf/scanf over the cout/cin family. -- Regards, Gregory Peet Fellow Digital MartianIndeed I a also using the STLPort library thanks for taking the time to check it out. Like I say I am not to bothered, as larger programs do not grow exponentially only very small increments Thanks Yeric A new Digital Martian <g>
Jul 30 2003
Hmmm Much fiddling later in IDDE and I have managed to get exe to 18kb How? In project settings set use dll runtime library ans et voilla 18kb however if you use the system ( "PAUSE" ) ; in program it crashes ouch but if you use cin >> some int ; it doesn't, anyone know what causes this ??? cheers Yeric
Aug 12 2003
Yeric wrote:HmmmmmmmHMuch fiddling later in IDDE and I have managed to get exe to 18kbSo you use IDDE. Command-line rules!In project settings set use dll runtime library ans et voilla 18kb however if you use the system ( "PAUSE" ) ; in program it crashes ouch but if you use cin >> some int ; it doesn't, anyone know what causes this ???Walter already said the DLL RTL support was broken. I was considering to make the compiler use Microsoft DLL RTL which is delivered with Windows - because it is the only way to make the compiler qualify for 64k-demos. If not RTL issue, DigitalMars would be the best compiler for such things around! -i.
Aug 12 2003
<g> yes, I could get prog to compile in about 18kb with command line before, but wanted to use the idde, well if you got it use it, I say <g>Walter already said the DLL RTL support was broken.Sorry I missed that one duteI was considering to make the compiler use Microsoft DLL RTL which is delivered with Windows - because it is the only way to make the compiler qualify for 64k-demos. If not RTL issue, DigitalMars would be the best compiler for such things around! -i.googled for this bit about rtl dll broken, could not find owt on it though, is it planned to be fixed in th future ? Yeric
Aug 13 2003
You have a file called "hello" containing the source? Are you using the CNope you are correct iostream in C++If it's C++, you have your answer...the implementation. I still have not found a mildly-sized C++ iostream. Use printf instead.Ok thanks
Jul 30 2003