On some of the embedded systems I worked on in the past, if you included printf, it could easily take 1/2 or more of the available memory (32K or so), since in these systems you usually don't have floating point instructions, and printf drags in the whole floating point and long long support functions to support %f and %Ld (newlib for instance has iprintf that is integer only). -----Original Message----- From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of James Nickson Sent: Friday, August 12, 2005 12:09 PM To: Nelson H. F. Beebe; gcc-help@xxxxxxxxxxx Cc: beebe@xxxxxxxxxxxxx Subject: Re: gcc and small command line tasks Thank you Dr. Beebe, got it in one. I did not think so much as 400K would be needed for a printf (laughing at myself again). Thanks all, Jay At 06:45 AM 8/12/05 -0600, Nelson H. F. Beebe wrote: >James Nickson <jaynicks@xxxxxxxxxxxxx> asks why a hello-world test >produced a 471K executable program. > >I suspect that what Jack was seeing in the simple hello.c test is the >difference between static and dynamic linking. > >For example, on Sun Solaris 8: > > % gcc -o hello hello.c > % ls -l hello > -rwxrwxr-x 1 beebe staff 6196 Aug 12 06:38 hello > > % gcc -static -o hello hello.c > % ls -l hello > -rwxrwxr-x 1 beebe staff 363296 Aug 12 06:39 hello > >While dynamic linking is the default on all modern operating systems, >there are cases (e.g., CD-ROM distribution of software and standalone >boot and rescue disks) where static linking is required to avoid >dependencies on shared libraries that might be in different locations >on some remote system than on the system where the executable was >built, or might be corrupted (consider what happens to your Unix >system if /lib/libc.so.1 develops a bad disk block: virtually nothing >can run). > > >----------------------------------------------------------------------- ---- ---- >- Nelson H. F. Beebe Tel: +1 801 581 5254 - >- University of Utah FAX: +1 801 581 4148 - >- Department of Mathematics, 110 LCB Internet e-mail: beebe@xxxxxxxxxxxxx - >- 155 S 1400 E RM 233 beebe@xxxxxxx beebe@xxxxxxxxxxxx - >- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe - >----------------------------------------------------------------------- ---- ---- > ============================================= James Nickson jaynicks@xxxxxxxxxxxxxx 19 O.Cheq.Nk.Rd., Wellfleet, MA 508.349.2422