[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lintian -- detecting hundrets of bugs within seconds...

joost witteveen wrote:
>That argument about C programmes taking less space is rather bogus.
>Ever tried typing
>echo 'main(){printf("Hello, world. Im C, and Im BIG!\n");}' > hello.c
>gcc hello.c -o hello
>du hello
>echo '#!/bin/bash' > hello
>echo 'echo hello, world. Im bash (or perl or whatever), and Im small'>>hello
>du hello

That demonstration about shell scripts taking less space is rather bogus.
I'm not saying that the hypothesis is wrong, just that the demonstration
is flawed.  There are large overheads involved with a minimal C program;
after the program gets a bit bigger, the overheads are negligible.

(The -fwritable-strings below is needed for a fair comparison.)


  echo 'main(){printf("Hello, world. Im C, and Im BIG!\n");}' > hello1.c
  gcc -fwritable-strings -o hello1 hello1.c
  ls -l hello1
  strip hello1
  ls -l hello1

shows that symbol tables & stuff are expendable and quite big.

  gcc -fwritable-strings -S hello1.c
  gcc -c hello1.s
  ls -l hello1.o
  strip hello1.o
  ls -l hello1.o

Startup code needed to make an executable is about 2K stripped.

  echo 'main(){printf("Hello, world. Im C, and Im BIG!\n");' > hello2.c
  echo 'printf("Hello, world. Im C, and Im BIG!\n");}' >> hello2.c
  gcc -fwritable-strings -S hello2.c
  gcc -c hello2.s
  strip hello2.o
  ls -l hello1.o hello2.o

The difference in size between hello1.o and hello2.o equals the
(unoptimized) size of one call to printf() plus the string passed.
This difference (on my system) is 48 bytes.  The shell script equivalent
to that printf() call is only a couple of bytes smaller.  Coding style
and feeping creaturism are likely to make a lot more difference than
the language you write in.

Charles Briscoe-Smith
White pages entry, with PGP key: <URL:http://alethea.ukc.ac.uk/wp?95cpb4>
PGP public keyprint: 74 68 AB 2E 1C 60 22 94  B8 21 2D 01 DE 66 13 E2

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: