home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / mod.std.unix.v1 / text0031.txt < prev    next >
Encoding:
Internet Message Format  |  1987-06-30  |  1.1 KB

  1. From: seismo!BBN-LABS-B.ARPA!dan (Dan Franklin)
  2. To: ut-sally!BBN-LABS-B.ARPA!std-unix
  3. Subject: Re: a bit more on getopt
  4. Date: 19 Jul 85 11:32:03 EDT (Fri)
  5.  
  6. >  > Actually this is important in some applications which do not already use
  7. >  > stdio and do not wish to load in the 10k or so overhead that using stdio
  8. >  > incurs. AT&T's code does not use stdio in getopt(3).
  9. >  Not true.  The size difference between:
  10. >      main() { puts("foo"); }
  11. >  and
  12. >      main() { write(0,"foo",3); }
  13. >  is exactly zero.
  14.  
  15. Your second one-liner is still using stdio.  The difference between
  16.        main() { puts("foo"); }
  17. and
  18.        main() { write(1, "foo", 3); }   exit(n) { _exit(n); }
  19. on the other hand, is substantial, at least on my 4.2 VAX system (and, in my
  20. experience, on other UNIX systems as well):
  21.  
  22. text    data    bss    dec    hex
  23. 2048    1024    15988    19060    4a74    stdio
  24. 1024    1024    0     2048     800    nostdio
  25.  
  26. 1024       0    25988   17012           difference
  27.  
  28. The point about not using stdio in a library routine if it's not necessary
  29. still stands.
  30.  
  31.     Dan Franklin
  32.  
  33.  
  34. Volume-Number: Volume 1, Number 32
  35.  
  36.