home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / fortran / 3050 < prev    next >
Encoding:
Text File  |  1992-08-16  |  2.2 KB  |  42 lines

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