Article View: mod.std.unix
Article #125Re: a bit more on getopt (retransmitted)
From: John Quarterman
Date: Tue, 23 Jul 1985 17:40
Date: Tue, 23 Jul 1985 17:40
44 lines
2237 bytes
2237 bytes
----------------------------------------------------------------------
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@ut-sally.ARPA
Comments-To: ut-sally!std-unix-request or std-unix-request@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)
Technical Details
Message-ID:
<2444@ut-sally.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!decvax!genrad!panda!talcott!harvard!seismo!ut-sally!jsqReferences:
<251@mcc-db.UUCP> <2365@ut-sally.UUCP> <2392@ut-sally.UUCP> <2401@ut-sally.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ut-sally.UUCP Path: arc1-ca.pugleaf.net!utzoo!decvax!genrad!panda!talcott!harvard!seismo!ut-sally!jsq From: jsq@ut-sally.UUCP (John Quarterman) Newsgroups: mod.std.unix Subject: Re: a bit more on getopt (retransmitted) Message-ID: <2444@ut-sally.UUCP> Date: Tue, 23-Jul-85 13:40:03 EDT Article-I.D.: ut-sally.2444 Posted: Tue Jul 23 13:40:03 1985 Date-Received: Wed, 24-Jul-85 01:40:28 EDT References: <251@mcc-db.UUCP> <2365@ut-sally.UUCP> <2392@ut-sally.UUCP> <2401@ut-sally.UUCP> Reply-To: std-unix@ut-sally.UUCP Organization: U. Texas CS Dept., Austin, Texas Lines: 44 Approved: jsq@ut-sally.UUCP