Path: utzoo!mnetor!uunet!mfci!root From: root@mfci.UUCP (SuperUser) Newsgroups: comp.lang.fortran Subject: Re: FORTRAN horrors (character init) Message-ID: <337@m3.mfci.UUCP> Date: 13 Apr 88 23:04:34 GMT References: <563@a.UUCP> Reply-To: karzes@m3.UUCP (Tom Karzes) Organization: Multiflow Computer Inc., Branford Ct. 06405 Lines: 39 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <563@a.UUCP> jlg@a.UUCP (Jim Giles) writes: }> Fortran 77 DOES have one VERY serious problem with strings: it }> is impossible to initialize them with non-printing characters. You can, }> of course, kludge it by installing things in after initialization: }> }> }> character*3 escseq }> data escseq/' [C'/ }> }> ... }> escseq(1:1) = char(27) } }Why not do: } character*3 escseq } parameter (escseq=char(27)//'[C') } }This is Fortran 77 standard. Or, if you insist that escseq needs to be a }variable, then do: } character*3 escseq,pescsq } parameter (pescsq=char(27)//'[C') } data escseq/pesc/ } }This also is standard Fortran 77. This second is admittedly clumsy, but }it works. Note that the 'fix' for this problem in Fortran 8x is not very }popular (Object-Oriented Data statements (5.2.6.2)). } }J. Giles }Los Alamos Rubbish. Neither of your examples are standard Fortran 77. The standard clearly states, in section 6.2.3, that a character constant expression may NOT contain function references. It doesn't matter if the arguments are constants and the functions are intrinsics. True, most Fortran compilers allow the examples you've shown, but they are most certainly not standard Fortran 77. (By the way, your second example has a typo, /pesc/ should be /pescsq/)