[PATCH] Optimize 'a ' as single char string too
Paul Richard Thomas
paul.richard.thomas@gmail.com
Wed Jul 14 10:24:00 GMT 2010
Dear Tobias,
It was me that raised the question.
> b) For character comparison, TRIM does not play any role, cf.
> "For a character relational intrinsic operation, the operands are
> compared one character at a time in order, beginning with the first
> character of each character operand. If the operands are of unequal
> length, the shorter operand is treated as if it were extended on
> the right with blanks to the length of the longer operand. If both
> x1 and x2 are of zero length, x1 is equal to x2; if every character
> of x1 is the same as the character in the corresponding position in
> x2, x1 is equal to x2. Otherwise, at the first position where the
> character operands differ, the character operand x1 is considered
> to be less than x2 if the character value of x1 at this position
> precedes the value of x2 in the collating sequence (1.3); x1 is
> greater than x2 if the character value of x1 at this position
> follows the value of x2 in the collating sequence."
> (F2008, 7.1.5.5.1 Interpretation of relational intrinsic operations)
To which this is a satisfactory answer :-)
> Thus, the optimization of ignoring the tailing blanks for
> if (c .eq. 'a ') call abort
> seems to be fine.
Indeed - thanks for digging into the standard. I just wanted to be
sure that the trailing spaces had no lexographic value.
Cheers
Paul
More information about the Fortran
mailing list