Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ames!skipper!altair!maine From: maine@altair.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.fortran Subject: Re: A Q of constants Message-ID: Date: 24 May 91 19:11:29 GMT References: <1991May24.111123.8396@cc.curtin.edu.au> <91143.213654KENCB@SLACVM.SLAC.STANFORD.EDU> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 37 In-reply-to: KENCB@SLACVM.SLAC.STANFORD.EDU's message of 24 May 91 05:36:54 GMT On 24 May 91 05:36:54 GMT, KENCB@SLACVM.SLAC.STANFORD.EDU said: ... [reasonable discussion of how to approximate the effect of an array of constant characters in F77] KENCB> Only the PARAMETER form gives you "an array of constants", and KENCB> it's not strictly an array. However the standard Fortran 77 KENCB> character handling allows indexing into character strings which KENCB> is nearly the same, e.g. use C2(3:3) instead of C2(3). Unfortunately standard F77 does not allow such substrings of parameters. I've been caught by this quirk myself. Though it certainly looks consistent and like it "ought" to be legal, it isn't standard. Some compilers might accept it as an obvious extension, but I'm sure that not all do. See section 5.7.1 of the F77 standard, where substrings are defined only for character variables or character array elements. Constants are not allowed, either as literals or by symbolic name. As I mentioned in my other post, this is legal in F90. It is possible to do roundabout things like character c1*6, c2*6 parameter (c2='abcdef') ... c1 = c2 whatever = c1(3:3) though it will probably puzzle anyone reading the code why this isn't expressed in the "obvious" (but illegal) way. -- -- Richard Maine maine@altair.dfrf.nasa.gov