Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-lcc!ames!ucbcad!ucbvax!jade!eris!mwm From: mwm@eris.BERKELEY.EDU (Mike (My watch has windows) Meyer) Newsgroups: comp.lang.c Subject: Re: Portable C vs Efficient C or "Cost of Portability" Message-ID: <3340@jade.BERKELEY.EDU> Date: Mon, 27-Apr-87 05:53:40 EDT Article-I.D.: jade.3340 Posted: Mon Apr 27 05:53:40 1987 Date-Received: Wed, 29-Apr-87 06:39:25 EDT References: <213@pyuxe.UUCP> <636@edge.UUCP> <1316@frog.UUCP> <658@edge.UUCP> <1017@ubc-cs.UUCP> <682@edge.UUCP> Sender: usenet@jade.BERKELEY.EDU Reply-To: mwm@eris.BERKELEY.EDU (Mike (My watch has windows) Meyer) Organization: Missionaria Phonibalonica Lines: 28 In article <682@edge.UUCP> doug@edge.UUCP (Doug Pardee) writes: >And even with the decent optimizing compilers, code size in C is awful. See >the discussion in comp.sys.amiga about how to get "hello, world" down from >8K to 1K! In assembler, it'd be maybe 50 bytes. > >-- Doug Pardee -- Edge Computer Corp. -- Scottsdale, Arizona You might make 50 bytes, Doug. But I'd be willing to bet against it. There's more than 500 bytes of overhead in that C program that re-arranges the environment to look like Unix. A lot of this you won't be able to avoid. If you're not used to OS's that consist of cooperating processes, some of it is liable to surprise you. At one point in the past, a friend and I had a contest to produce the shortest executable file to do a simple task (continously output a string of C-G's to stdout) on a v6 Unix system. As I recall, it was a draw. His carefully tailored assembler program, with the a.out header hand-stripped from it, was the same size as my shell script - 17 bytes. Of course, I can produce a smaller shell script now.....