Character variables

The manipulation of long character data has hidden overheads. In particular, consider the following:

CHARACTER(LEN=100)::A
. . .
A = 'FRED'

The execution of the assignment statement involves the insertion of 96 blanks to pad out the variable A to its declared length of 100. Note, however, that

A = ' '

is far more efficient than for example:

. . .
DO I=1,100
A(I:I) = ' '
END DO
. . .

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited