Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ncar!netnews.whoi.edu!news From: rich@boreas.whoi.edu Newsgroups: comp.lang.fortran Subject: Re: MS-FORTRAN bug in string concatenation Message-ID: <1991Feb16.143646.3332@netnews.whoi.edu> Date: 16 Feb 91 14:36:46 GMT References: <2PWGG2@MPLVAX.SRI.COM> <1991Feb14.185049.3535@convex.com> Sender: news@netnews.whoi.edu Organization: Woods Hole Oceanographic Institution Lines: 57 In article <1991Feb14.185049.3535@convex.com> dodson@convex.COM (Dave Dodson) writes: >In article <2PWGG2@MPLVAX.SRI.COM> HUESTIS@MPLVAX.SRI.COM (David L. Huestis) writes: >>Under Microsoft FORTRAN the following simple program >> >> character string*4/'abc'/ >> string = '*'//string >> write(*,*)string >> end >> >>produces the output '**bb' while LAHEY and VAX yield '*abc' > >The above program is non-standard. In a standard-conforming program, string >variables cannot appear on both the left- and right-hand side of an assignment >statement. >Dave Dodson dodson@convex.COM This is interesting...according to my Vax-Fortran manual (which describes how they implement fortran 77) "the character assignment statement has the form v=e where v as a character variable, array element, or substring e is a character expression If the length of the character expression is greater than the length of the character variable [...] then the character expression is truncated on the right. If the length of the character expression is less than the length of the character variable [...] then the character expression is filled on the right with spaces. (similar rules hold true for DATA statements). Nowhere does it mention that this is not standard conforming. However, if this is indeed the case, then is the statement string='*'//string(1:3) also non-conforming? -- Rich Pawlowicz ----------------- INTERNET: rich@boreas.whoi.edu Woods Hole Oceanographic Institution "Home of the 59-cent squid burger (cheese extra)" --------------------------------------------------------------