Re: multidimensional arrays
Re: multidimensional arrays
- Subject: Re: multidimensional arrays
- From: Pandaa <email@hidden>
- Date: Wed, 16 Mar 2005 04:00:11 +0100
2005-03-16 kl. 01.49 skrev John Stiles:
On Mar 15, 2005, at 4:33 PM, Pandaa wrote:
Many optimizations requires good data dependency analysis, which the compiler may have difficulties doing on pointer arithmetic expressions.
Not really.
Yes, really. Read up on auto vectorization.
Did you know that a[b] is the exact equivalent of *(a+b)? Yes, for any a and b that you could think of.
Of course, a[b], b[a], *(a+b) are all equivalent.
For example, this rule is why 1[x] compiles and runs just as well as x[1]. (Yup, it does—try it.) Or why you can convert a number to a hex character with "0123456789ABCDEF"[number].
C is full of clever tricks like this that you should avoid because they are hard to understand when you look back at your old code a year or two later :)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. email@hidden . . www.synapticpulse.net .
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden