[scribus-dev] for i
Craig Bradney
cbradney at zip.com.au
Wed Sep 21 16:28:13 UTC 2011
On 9/21/11 5:54 PM, a.l.e wrote:
> hi
>
>
> having been hacking a bit on scribus lately, i was wondering why each "for loop" has a different letter as the index.
>
> personally, i've learned to always use i, j and k (in this order, avoiding nesting them if possible) for the "for" loops.
>
> the big advantage is that each time you see an i, a j or a k you know it's a counter and just have to look at the definition of the loop to check what its value means and understand what it does.
>
> currently, any single letter or combination of two letter is in use. that way you have to go up the code one line at a time and see where the "a" (or c, or p, or pa...) is defined... until you get to the loop definition.
>
> or are scribus developers only using single letter variables for the loops?
>
> does anybody agree on using "i" whenever it's possible?
>
>
> ciao
> a.l.e
>
>
Hi Ale
and.. c for count, p for pointer, a for apples, i for image, p for picture, si for selected items..
or whatever.
Using something other than i,j,k is not better or worse. This is really pedantic, and there can be
very good reasons for using something other than i (like when counting apples and a might make more
sense? :)). Don't forget, some of the code still has its German heritage in place too.
I don't see any massive value in an effort to rename them in one go, but feel free to using i,j,k in
your own code. If you or others want to work to rename things, then cool. Having a generalised
convention can be of use which I would support, but enforcing it is not entirely a good use of time
or effort.
Thanks
Craig
More information about the scribus-dev
mailing list