Path: utzoo!utgpu!water!watmath!clyde!rutgers!ukma!gatech!udel!rochester!bbn!uwmcsd1!ig!agate!ucbvax!FSU.BITNET!adk From: adk@FSU.BITNET (Tony Kennedy) Newsgroups: comp.os.vms Subject: Zero length strings in Fortran. Message-ID: <[gw.scri.fsu.edu].B08F73A0.0090E265.ADK> Date: 9 Feb 88 22:31:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 24 From: ZSYJKAA@WYOCDC1.BITNET (Jim Kirkpatrick 307 766-5303) Subject: FORT vs. zero-length strings If anybody has the ANSI standard handy, could you look up the formal definition of a character string and let us (or me) know if zero-length strings are OK? I'd hate to flame DEC if ANSI deserves it instead. ---------------------------------------- (A) Zero length strings are not valid in ANSI FORTRAN 77. (B) Zero length strings are valid in the current Fortran 8x draft. (C) Your discussion of padding strings etc. is not quite right. The problem in the program fragment CHARACTER*(8) STRING ... STRING = '' is that the character constant ('') is invalid because it has length zero. If it were valid, it would then be padded to a string of length eight containing only spaces. In this case using a length one string containing a space (' ') would work just fine. Please note that I am not saying the FORTRAN 77 behaviour is a good thing, I am just saying that it is what it is!