Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!shadooby!accuvax.nwu.edu!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: stdout (was What "isatty"?) Message-ID: <17796@mimsy.UUCP> Date: 31 May 89 00:49:56 GMT References: <19756@adm.BRL.MIL> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 26 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@adm.BRL.MIL> rbj@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@mimsy.umd.edu Path: uunet!mimsy!chris