Sun Studio 12: Debugging a Program With dbx


Here is an example of a two-dimensional, rectangular slice of a C++ array, with the default stride of 1 omitted.

print arr(201:203, 101:105)

This command prints a block of elements in a large array. Note that the command omits stride-expression, using the default stride value of 1.

Diagram of an array with columns 100 through 106 and
rows 200 through 205. Elements in columns 101 through 105 of rows 201 through
203 are shaded.

As illustrated, the first two expressions (201:203) specify a slice in the first dimension of this two-dimensional array (the three-row column). The slice starts with row 201 and ends with 203. The second set of expressions, separated by a comma from the first, defines the slice for the second dimension. The slice begins with column 101 and ends with column 105.