home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!sun-barr!ames!news.hawaii.edu!galileo!tholen
- From: tholen@galileo.ifa.hawaii.edu (Dave Tholen)
- Subject: Re: programming style question
- Message-ID: <1992Aug16.195651.25319@news.Hawaii.Edu>
- Sender: root@news.Hawaii.Edu (News Service)
- Nntp-Posting-Host: galileo.ifa.hawaii.edu
- Organization: University of Hawaii
- Date: Sun, 16 Aug 1992 19:56:51 GMT
- Lines: 30
-
- Claude LaPointe writes:
-
- > Because the 77 standard didn't much consider the kinds of output
- > capabilities now available, it didn't address standard error,
- > so there is no choice but to use a unit number - however it should
- > be done with the realization that porting may require a change in the
- > value. That is, isolate its use as much as possible in a subprogram
- > and define it with a parameter statement.
-
- Actually, I do isolate its use. I try to put as much system-dependent
- stuff in a BLOCK DATA subprogram, so when I need to port a program from
- the PC environment to a Sun workstation, for example, I just edit one
- tiny block of code, namely the BLOCK DATA subprogram, and change unit
- numbers and filenames as needed. Unit numbers are rarely changed
- nowadays, because my most commonly used platforms all associate 0 with
- standard error, 5 with standard input, and 6 with standard output. But
- filenames are constantly changed, due to the 8.3 limitation of the FAT
- file system on the PC, and the differences in the use of backslash and
- forward slash. Another change I make in my BLOCK DATA subprogram
- depends on whether the system strips a carriage control character from
- the standard output stream. Some do, some don't. The main program
- and all the other subprograms, however, are written with portability
- in mind. But now I have this compiler that doesn't preconnect standard
- error. So I must decide whether to route error messages through the
- standard output channel or explicitly open a separate unit. The former
- might mess up redirection, because many of my programs were written
- with separate output streams for error messages and non-error-message
- text specifically with the possibility of redirection in mind. One
- does not always want to redirect ALL output, hence the use of two
- (or more) output streams.
-