adk@FSU.BITNET (Tony Kennedy) (02/10/88)
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!
cdb@hpclcdb.HP.COM (Carl Burch) (02/23/88)
> (B) Zero length strings are valid in the current Fortran 8x draft.
Zero-length substrings and dummy arguments ("formal parameters" in
other languages) are defined in the F8x draft - but not any constant
of zero length. So '' will still be an error.
Carl Burch
HP Fortran Lab