[EMAIL PROTECTED] (Ludovic Court�s) writes: > Can one expect the increment returned by `scm_TAGvector_elements ()' to > always be 1 when TAG is `u8', 2 when TAG is `u16', and so on?
No, you can't. The increment gives the number of _elements_ between the real elements of the vector in memory, not the number of _bytes_. Very nearly all vectors will have an increment of 1, but not all. See "Shared Arrays" in the manual: shared arrays of rank one are vectors, but they don't need to be stored contiguously in memory. For example, the diagonal of a 3x3 matrix is a vector, and to go from one element of this vector to the next, you need to skip 4 elements in memory (one full row of the matrix plus one more). Such a vector has an increment of 4. The size of an element in a uniform numeric vector can be retrieved with scm_array_handle_uniform_element_size, if you need it. > I have this impression, although I couldn't find proofs in the > source code. Maybe we could improve the manual. Do you have a suggestion? -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 _______________________________________________ Guile-user mailing list [email protected] http://lists.gnu.org/mailman/listinfo/guile-user
