a bit more on getopt (retransmitted)
John Quarterman
jsq at ut-sally.UUCP
Wed Jul 24 03:40:03 AEST 1985
----------------------------------------------------------------------
From: seismo!BBN-LABS-B.ARPA!dan (Dan Franklin)
To: ut-sally!BBN-LABS-B.ARPA!std-unix
Subject: Re: a bit more on getopt
Date: 19 Jul 85 11:32:03 EDT (Fri)
> > Actually this is important in some applications which do not already use
> > stdio and do not wish to load in the 10k or so overhead that using stdio
> > incurs. AT&T's code does not use stdio in getopt(3).
>
> Not true. The size difference between:
>
> main() { puts("foo"); }
> and
> main() { write(0,"foo",3); }
>
> is exactly zero.
Your second one-liner is still using stdio. The difference between
main() { puts("foo"); }
and
main() { write(1, "foo", 3); } exit(n) { _exit(n); }
on the other hand, is substantial, at least on my 4.2 VAX system (and, in my
experience, on other UNIX systems as well):
text data bss dec hex
2048 1024 15988 19060 4a74 stdio
1024 1024 0 2048 800 nostdio
1024 0 25988 17012 difference
The point about not using stdio in a library routine if it's not necessary
still stands.
Dan Franklin
------------------------------
Discussions-Of: UNIX standards, particularly the IEEE P1003 draft standard.
Submissions-To: ut-sally!std-unix or std-unix at ut-sally.ARPA
Comments-To: ut-sally!std-unix-request or std-unix-request at ut-sally.ARPA
UUCP-Routes: {ihnp4,seismo,harvard,gatech}!ut-sally!std-unix
Archives-In: ~ftp/pub/mod.std.unix on ut-sally.ARPA (soon sally.UTEXAS.EDU)
More information about the Mod.std.unix
mailing list