C vs. FORTRAN (was: What should be added to C)

Daniel R. Levy levy at ttrdc.UUCP
Sat May 31 15:56:13 AEST 1986


In article <477 at cubsvax.UUCP>, peters at cubsvax.UUCP (Peter S. Shenkin) writes:
>In article <bentley.853> kwh at bentley.UUCP (KW Heuer) writes:
>>Another advantage of FORTRAN is implicit DO loops in I/O statements, and the
>>related ability to use (constant, at least) repeat counts in FORMATs.  I had
>>a program that made this painfully clear when it was translated from FORTRAN
>>to C.
>I agree;  on the other hand, what C has over FORTRAN in this regard is the
>ability to keep writing on the same line in subsequent calls to printf();
>that is, to *not* insert a newline after WRITEing.
>Peter S. Shenkin	 Columbia Univ. Biology Dept., NY, NY  10027
>{philabs,rna}!cubsvax!peters		cubsvax!peters at columbia.ARPA

This is probably as much OS-dependent (actually filesystem/device driver
dependent) as it is language dependent.  Fortran I/O seems to be better suited
to record-oriented OS's such as VMS, while C I/O seems to be better suited
to stream-oriented OS's like UNIX.

True, Fortran 77 doesn't offer a way to keep printing on the same output
line once a given WRITE statement has finished, but a (common?) extension
(maybe it will be official in a Fortran 88?) is to allow the edit descriptor
'$' in a format statement to signify that the current record has not yet been
completely written.  VMS Fortran and UNIX f77 both support this, and I must
say that UNIX f77 does it better in that it supports this kind of operation
when writing to files or to a terminal, while VMS Fortran can only support it
when writing to a terminal (being locked into a record-oriented filesystem
treatment--once you've finished writing to that record, that's it buddy).
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
						vax135}!ttrdc!levy



More information about the Comp.lang.c mailing list