When it comes to addressing several times a particular component of
an array or a component of an array of derived type I always feel a
strong tendency to allocate an additional variable set to this value.
I then continue using this variable, as in the following example,
ia=sf(isc)%ia
if (sf(isc)%as(ia:ia) == 'h') ...
instead of writing
if (sf(isc)%as(sf(isc)%ia:sf(isc)%ia) == 'h') ...
(Here sf%ia is an integer and sf%as is a character string.)
But I also have my doubts if it's resonable, what I'm doing,
or if it would be better to rely on the cleverness and
efficiency of the compilers, and not wasting an extra memory
location. The situation might be a bit different if some
index arithmetic is required.
I'm curious to see the comments of the compiler experts.
Thanks in advance,
Roland
+----------------------------------------------------------------------+
| Roland Schilling Home-Office: +49(89)32929-670 |
| Max-Planck-Institut fuer Quantenoptik Phone: +49(89)32905-265 |
| Hans-Kopfermann-Str. 1 Fax: +49(89)32905-200 |
| D-85748 Garching E-mail: [log in to unmask] |
| Germany http://www.geo600.uni-hannover.de |
+----------------------------------------------------------------------+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|