[comp.lang.fortran] Fortran identifiers around the world

garry@batcomputer.tn.cornell.edu (Garry Wiegand) (12/02/86)

Hi -

I'm trying to come up with a Fortran binding for a large subroutine
library we've written in C. Converting the arguments properly has been
solved; now we're just worrying about what the "standard" fortran
routine *names* should look like. Our standard C routine names are a 
mile long (but very descriptive :-) and contain lots of _'s.

What I'm wondering is whether it's worth *attempting* to make our names
acceptable to the "Fortran-77" compilers of the world, or whether I
should just give up and always insist on a preprocessing step.

What I know so far:
                                 identifier   dollar signs,
                                   length     underscores OK

    Vax/VMS                 --       31          yes    
    BSD Unix                --       16          no     
    IBM (not sure of this)  --        6          no     
    SVS (68000)             --       31          no     


And what I'm specifically wondering is: is there any consensus on name
length? Is there any consensus on underscores? I'm soliciting votes...

Thanks much. If there's interest I'll post the results.

garry wiegand   (garry%cadif-oak@cu-arpa.cs.cornell.edu)

tp@ndmce.uucp (Terry Poot) (12/03/86)

ANSI standard FORTRAN-77 allows only 6 character identifiers, and no dollar
signs or underscores. If you count on anything more, you will eventually be
disappointed. If you insist on a pre-processing step, you had better be
willing to provide the pre-processor, as most non-unix fortrans don't have
one.

(Sorry for posting, but I have tried and failed in the past to reach that
site by email.)
-- 
Terry Poot, Nathan D. Maier Consulting Engineers, (214)739-4741
8800 N. Central Expressway, Suite 300, Dallas, Tx 75231, USA
UUCP: { seismo | cbosgd | ihnp4 | sun!convex | allegra!convex }!ndmce!tp
ARPA: ndmce!tp@seismo.css.gov   CSNET: ndmce!tp@smu

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.)