in reply to RE: Buzzcutbuddha(You provided disinformation): C Style For and Foreach The Same
in thread Finding the length of an array of arrays
I said that foreach loops are faster than classic C-style loops. Yes, you can write a classic C-style loop using foreach. But nobody thinks that way.
And indeed iterating directly over a list is *significantly* faster, less error prone, etc, than doing an explicit loop over the indices, looking up array values inside the loop. That is not disinformation, that is simple fact and I have found that that factual information carries a lot more weight with C programmers starting out with Perl than saying, "Well the standard Perl idiom is..."
Have you ever said, "This is Perl Style and easier to understand." and been told, "Well I am a C programmer, I have been using for loops for 15 years and they are easier for me to understand because I am used to them."? You won't win that argument...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Buzzcutbuddha(I Stand Corrected): C Style For and Foreach The Same
by buzzcutbuddha (Chaplain) on Aug 19, 2000 at 00:34 UTC | |
by jcwren (Prior) on Aug 19, 2000 at 04:05 UTC |