X3J3/96-064 Date: April 3, 1996 To: X3J3 From: Jeanne Martin Subject: More about controlling pointer bounds References: X3J3/96-057 User Control of Pointer Bounds X3J3/96-058 Proposal A X3J3/96-059 Proposal B There is another aspect of user control over pointer bounds that has to do with the direction of the stride. Note that the stride is always 1 (in magnitude) regardless of the distance between array elements. This can best be explained by some examples: integer, target :: t(0:10) = (/ (i, i=0,10) /) integer, pointer :: p(:) lbound ubound values ------ ------ ------ 1. now p => t(0:5) 1 6 0 1 2 3 4 5 2. new p(0:) => t(0:5) 0 5 0 1 2 3 4 5 3. now p => t(0:10:2) 1 6 0 2 4 6 8 10 4. new p(0:) => t(0:10:2) 0 5 0 2 4 6 8 10 5. now p => t(10:5:-1) 1 6 10 9 8 7 6 5 6. new p(10:) => t(10:5:-1) 10 15 10 9 8 7 6 5 7. now p => t(10:0:-2) 1 6 10 8 6 4 2 0 8. new p(10:) => t(10:0:-2) 10 15 10 8 6 4 2 0 Perhaps what was really wanted in 6. and 8. was an lbound of 10 and a ubound of 5, but this is not possible unless a further addition is made to the language. Possible syntax including a stride direction: 6. new p(10::-1) => t(10:5:-1) 10 5 10 9 8 7 6 5 but this seems somewhat inappropriate for 8., so another alternative could be: 8. new p(10(-):) => t(10:0:-2) 10 5 10 8 6 4 2 0 If there is concern about consistency between pointer association and argument association, this functionality could be applied to argument association as well. It is not currently provided although control over bounds is. Straw Vote: Should pointer association provide a mechanism for users to control the direction of stride. If so, Straw Vote: Should this mechanism be extended to argument association? -------------------------------------------------------------------------- Jeanne Martin, Lawrence Livermore National Laboratory, Livermore, CA 94550 email: jtm@llnl.gov postal code: L-300 phone: (510) 422-3753 fax: (510) 423-8704