If a pointee is declared as a character type, its Cray pointer is a Cray character pointer.
A Cray character pointer is a special data type that allows f90 to maintain character strings by keeping track of the following:
Byte address of the first character of the string
Length
Offset
An assignment to a Cray character pointer alters all three. That is, when you change what it points to, all three change.
For a pointee that has been declared with an assumed length character type, the Cray pointer declaration statement declares the pointer to be a Cray character pointer.
Before the Cray pointer declaration statement, declare the pointee as a character type with an assumed length.
Declare a Cray pointer to that pointee.
Assign a value to the Cray character pointer.
You can use functions CLOC or FCD, both nonstandard intrinsics.
Example: Declare Ccp to be a Cray character pointer and use CLOC to make it point to character string s.
CHARACTER*(*) a POINTER ( Ccp, a ) CHARACTER*80 :: s = "abcdefgskooterwxyz" Ccp = CLOC( s )
You can do the following operations with Cray character pointers:
Ccp1 + i |
Ccp1 - i |
i + Ccp1 |
Ccp1 = Ccp2 |
Ccp1 relational_operator Ccp2 |
where Ccp1 and Ccp2 are Cray character pointers and i is an integer.
All restrictions to Cray pointers also apply to Cray character pointers. In addition, the following apply:
A Cray character pointee cannot be an array.
In a relational operation, a Cray character pointer can be mixed with only another Cray character pointer--not with a Cray pointer, not with an integer.
A relational operation applies only to the character address and the bit offset; the length field is not involved.
Cray character pointers must not appear in EQUIVALENCE statements, or any storage association statements. (The size can vary with the platform.)
Cray character pointers are not optimized.
Code containing Cray character pointers is not parallelized.
A Cray character pointer in a list of an I/O statement is treated as an integer.