stdout (was What "isatty"?)
Chris Torek
chris at mimsy.UUCP
Wed May 31 10:49:56 AEST 1989
In some article whose referent is gone because Root Boy gets this stuff
via a mailing list rather than netnews, I wrote:
>>Programs that produce output should produce the output to stdout.
In article <19756 at adm.BRL.MIL> rbj at dsys.icst.nbs.gov (Root Boy Jim) writes:
>I agree completely, Chris. Now get cracking on `cc', so that
>`cc prog.c' writes to stdout instead of `a.out' :-)
As you can see by the `:-)' sign, Jimmy C. is kidding. But there is
much truth in this. The C compiler should write to stdout, unless
there is some overriding reason that it cannot---and in fact, the
compiler proper (/lib/ccom on many Unixes, or /lib/c0 and /lib/c1 on
some others) *does* write to stdout. So does the C preprocessor (often
/lib/cpp), and the peephole optimiser (/lib/c2). The assembler does
not, but that is because its `output' is not something ordinary
programs can deal with---and this excuse is quite weak---or because it
wants to seek on the output file. (`ld' does a bit of seeking; but I
am not at all sure about the many different assemblers out there.)
At any rate, `cc' is clearly wrong to write to `a.out'. A much
better approach would be for it to default to `cc prog.c' producing
`prog' (or even `prog.out' or the like). It is probably too late
to change it now, but that does not make it any less wrong.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.wizards
mailing list