Blitz logo

Blitz Support :

From: Julian Cummings (cummings_at_[hidden])
Date: 2004-03-19 14:17:34


Hi Jason,

If by negative indices you mean less than the base index, then yes, I
believe you will go into adjacent areas in the referenced array. For a
one-dimensional Array, the behavior should be pretty straightforward,
but things might get a bit strange in higher dimensions if you go out of
bounds in a subarray.

Array bounds checking and other sanity checks are enabled by defining
the macro BZ_DEBUG when compiling your code. You might want to try this
and see if it helps with your code debugging efforts. Basically, you
cannot rely on any defined behavior when you go outside the array bounds
of a subarray. Also remember that a subarray will automatically use an
indexing scheme with unit stride, not the stride with respect to the
original Array.

Regards, Julian C.

Jason Crosswhite wrote:

>Hello,
>
>How do negative indexes in subarrays work? When you walk off the end of
>a subarray, does it go in to the adjacent entry in the referenced
>array? I've tried little tests that seem to indicate yes, but when
>trying it in my real code, I get strange effects. It very well could be
>a bug elsewhere in my code, but it is taking me a long time to find it,
>and I wanted to make sure I am doing something valid.
>
>Thanks.
>
>

-- 
Dr. Julian C. Cummings                       E-mail: cummings_at_[hidden]
California Institute of Technology           Phone:  626-395-2543
1200 E. California Blvd., Mail Code 158-79   Fax:    626-584-5917
Pasadena, CA 91125