Code Space Efficiency [ HP FORTRAN 77/iX Programmer's Guide ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Programmer's Guide
Code Space Efficiency
The suggestions below help to decrease the amount of space needed to
store your program.
Use Function Subroutines
Use function subprograms instead of statement functions because the code
to execute statement functions is generated every place the function is
called. Of course, you are sacrificing run-time efficiency because an
extra procedure call is executed for the subprogram call.
Avoid Formatted I/O
When possible, avoid formatted I/O because the format strings are stored
in your program.
Use Character Substrings
When assigning a character constant to a character variable that is
longer than the constant, specify a substring equal to the constant size
for the variable. For example, if charstring is longer than three
characters, use the statement:
charstring(1:3) = 'ABC'
instead of:
charstring = 'ABC'
This eliminates the code that is generated to fill the remainder of the
character variable with blanks. However, this should be done only if you
do not need the remainder of the variable to be filled with blanks.
MPE/iX 5.0 Documentation