Aesthetics, FORTRASH, and C.

Richard A. O'Keefe ok at quintus.UUCP
Fri Jan 29 17:43:16 AEST 1988


In article <11524 at brl-adm.ARPA>, lamonts at M5.Sdsc.EDU (Steve Lamont) writes:
> Howcome?  I've been programming in FORTRAN for about 10 years, both writing
> my own code and maintaining others' and find it useful to know which program
> unit (subroutine or function) has the capability of diddling with what 
> external variable and which program doesn't.  Are you saying that lumping
> all externals into one pool is *more* maintainable?  How so?  How else do
> you suggest?  I'm genuinely interested.  But, then, again, I happen to like
> implicit declarations, too... ;-) <---- flamers... note smiley guy...

I can't figure out whether he is arguing FOR common blocks (view:
C's "extern" is one giant pool) or AGAINST them (view: a common block
is a large pool).

I heartily agree that it is useful to know which thing can change what.
All you need is a C compiler or Lint which warns "inner declaration
hides outer", and then word-mode search in your favourite editor tells
you exactly what you know.  (Have you ever tried looking through
Fortran sources for PIDATA only to find that the key place wrote
instead PI DATA (spaces are legal inside Fortran tokens...)?)

Evidently the Fortran standards committee think something is wrong
with common blocks too, because Fortran 8X puts COMMON on the
don't-use-this-in-new-programs-because-it-is-going-away list;  the
replacement is an uncommonly ADA-like "USE".

The traditional implementation of C was "each extern variable is a
common block".  What's the difference between a C program and a
Fortran program where each common block contains one variable?
Apart from the fact that the Fortran program has the chance to
declare
	INTEGER FRED
	COMMON /FRED/ FRED
in one place and
	CHARACTER*4 FRED
	COMMON /FRED/ FRED
in another....

On the B6700 there was this neat symbolic debugger where you could
ask "show me all the places where such-and-such a variable is assigned".
Interlisp has this neat thing called Masterscope which you can ask
"edit all the places where such-and-such a variable is changed".
                                     n
Is anyone trying to put together an R -like environment for C?



More information about the Comp.lang.c mailing list