In article <42ff03c9-965e-4bfc-8635-f17ebe6cb49b@f36g2000hsa.googlegroups.com>,
<vippstar@gmail.comwrote:
Quote:
>Just curious, but is it possible to tell me a situation or two where
>you see the integer constants in array indexes?
>Surely in cryptographic functions, and anything that has to do with
>parsing of things whose size is always known. (IP addresses, etc)
>But other than that?
Arrays are often used as a form of data structuring. For example,
it is common to have 2D arrays whose rows are [X, Y, Z] triples.
This -could- be implemented as an array of
struct {double X; double Y; double Z} but with the possible
padding between elements of a struct this could take more room than
it needs to -- and there are times where the appropriate coordinate
number needs to be calculated and so a struct can become cumbersome.
I mostly program in MATLAB these days; it is quite common in MATLAB
to see constructs such as V(:,3) meaning the 3rd column of all rows
of V, or W(2,:) meaning all columns of the 2nd row of W.
--
"Allegories are in the realm of thoughts, what ruins are in
the realm of things." -- Walter Benjamin