hodgesse1 / rfortran

Automatically exported from code.google.com/p/rfortran
0 stars 0 forks source link

minor patch to messageLog (avoid using TRIM unnecessarily) #80

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The attached patch reduces some of the code in messageLog by avoiding the use 
of TRIM unnecessarily in string assigments and comparisons.

Note that trailing blanks are not significant in Fortran string assignmment and 
comparison, and using TRIM unnecessarily creates another copy of potentially 
long strings.

I came across this while debugging some other unrelated code.

Original issue reported on code.google.com by dmitri.k...@gmail.com on 6 Sep 2010 at 5:57

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks D, Fixed in Rfortran revision 2.1.3

In future all issues relate to MUtilslib file, should be posted at

http://code.google.com/p/mutilslib/issues/list

Original comment by mark.th...@gmail.com on 2 Dec 2010 at 12:53

GoogleCodeExporter commented 8 years ago
D,

I use TRIM when concatenating two strings because if I don't then trailing 
blanks are included in the contatenated string

If three string are assigned as follows:

character(len=10) :: y="Hello"
character(len=10) :: x="D"
character(len=20) :: z=""

with the following concatenation

z=x//y 

then z="Hello     D"

whereas with using TRIM

z=trim(x)//trim(y) 

then z="HelloD" 

which is the result I am usually after

Mark

Original comment by mark.th...@gmail.com on 2 Dec 2010 at 3:48