garry@batcomputer.tn.cornell.edu (Garry Wiegand) (12/15/86)
[cross-posted to comp.lang.misc; followup to comp.lang.fortran please] In a recent article bill@hcx1.UUCP wrote: >> In a recent article I wrote: >> And what I'm specifically wondering is: is there any consensus on name >> length? Is there any consensus on underscores? I'm soliciting votes... >... >I suggest you read the FORTRAN/77 standard. >... Why am I getting this incredible amount of abuse? My mailbox is overflowing - I *KNOW* what the Fortran/77 standard says! I originally asked my question because: 1) I like to write "programmer-friendly" software. Part of being friendly, to me, is using meaningful subroutine and variable names. On any major project it's just not possible to choose 6-character names and retain any meaning. When you have hundreds of subroutines to choose from, and you're writing code, you end up always reaching for the manual to find out if you want "JSPNC1" or "JSPCN2". Later, when you or someone else has to read that code back, it's just gibberish. 2) Standards enshrine mediocrity and the status quo. Standards are formal descriptions of the way IBM's software behaved on the day the standard was written. Just because a mediocre language standard exists in the world doesn't mean that one must always write mediocre code to match it - if it did, things like Fortran would stop evolving and eventually (it may take a while :-) have to be left behind. Which would be a pity, after all the work put into them. 3) The standard specifies a *minimum* for identifier length. I was interested in ascertaining the actual, real, consensus on the subject. I can remember Data General only supporting 5 characters as recently as 1978 - surely they do better now! So I looked at the five implementations I happened to have access to, and, lo and behold, they all supported considerably more than 6 (except IBM). So then I asked the net. (And got told 10 times over to "read the standard".) 4) Lastly, Fortran is just one among many languages, and I need to write and document for the greatest good among our likely users. Anyhow, significant-in-the-first-sixteen I probably could have managed, but six is purely too few. So I guess I'm going to have to provide a pre-processor for some systems. Alas. I will also publish the official "encryptions" for those who want to go direct. I hope I've stirred some thought. garry wiegand (garry%cadif-oak@cu-arpa.cs.cornell.edu) (For those interested, Dik T. Winter, of CWI, Amsterdam, was kind enough to provide: length underscores CDC 7600 etc. 7 no CDC Cyber 205 8 no Cray-1, Cray X-MP 8 no Fujitsu VP series, like IBM \ Hitachi, like IBM > 6 no (I think) NEC supers, like IBM / many others 6 no And Tom Stockfish, of UC San Diego, mentioned: Unix f77 prepends and postpends "_" to all identifiers in fortran programs. [true on one of my unixes; not true on the other.] Unix C prepends "_" to all identifiers in C programs. Unix f77 identifiers in fortran programs cannot have any underscores in them [true on mine too] and must be six chars or less [not true on either of mine]. and goes on to talk about how one arranges to call between C and Fortran, which discussion I will forward to anyone who likes.)