Article View: mod.std.unix
Article #121Re: a bit more on getopt
From: John Quarterman
Date: Fri, 19 Jul 1985 22:53
Date: Fri, 19 Jul 1985 22:53
32 lines
1736 bytes
1736 bytes
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
Technical Details
Message-ID:
<2409@ut-sally.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!decvax!genrad!mit-eddie!think!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!mit-eddie!think!harvard!seismo!ut-sally!jsq From: jsq@ut-sally.UUCP (John Quarterman) Newsgroups: mod.std.unix Subject: Re: a bit more on getopt Message-ID: <2409@ut-sally.UUCP> Date: Fri, 19-Jul-85 18:53:13 EDT Article-I.D.: ut-sally.2409 Posted: Fri Jul 19 18:53:13 1985 Date-Received: Sat, 20-Jul-85 18:14:42 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: 34 Approved: jsq@ut-sally.UUCP Discussions-Of: UNIX standards, particularly the IEEE P1003 draft standard.