|
Home > Archive > Apache Directory Project > November 2005 > [Coding Conventions] FYI: Why I use ii, jj, kk instead of i, j, k
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
[Coding Conventions] FYI: Why I use ii, jj, kk instead of i, j, k
|
|
| Alex Karasulu 2005-11-01, 5:45 pm |
|
Just a heads up. I see others using i,j,k for loop variables. This is
commonly the convention and I don't expect others to do what I do
especially with something as relatively insignificant as this. However
I thought I'd let you know why I do this and who I learned it from.
Robb Penoyer was using this a while back (10 years ago in C) when I
asked why he does not just use i,j,k and instead uses ii,jj,kk instead.
I was just curious. He said that he can search and find these variables
more easily in loops and he was right. I found this helpful several
times so I adopted the convention. It does not hurt readability and
allows me to search for loop variables easily since not every word
contains ii, jj, or kk. If everyone likes it we can use this as a
convention. We need to start solidifying a coding convention for the
entire TLP.
I think much more important than this loop variable example is to get
everyone to use 4 spaces for tabs instead of tabs which messes up SVN.
That should be law IMO. Many people have adjusted their editors to fix
this issue in Java but I still see this problem all over in XML and
properties files.
Alex
| |
| Trustin Lee 2005-11-01, 8:45 pm |
| Hi Alex,
2005/11/2, Alex Karasulu <aok123-Bdlq13kUjeyLZ21kGMrzwg@public.gmane.org>:
>
> Robb Penoyer was using this a while back (10 years ago in C) when I
> asked why he does not just use i,j,k and instead uses ii,jj,kk instead.
> I was just curious. He said that he can search and find these variables
> more easily in loops and he was right. I found this helpful several
> times so I adopted the convention. It does not hurt readability and
> allows me to search for loop variables easily since not every word
> contains ii, jj, or kk. If everyone likes it we can use this as a
> convention. We need to start solidifying a coding convention for the
> entire TLP.
We can still find all occurring of a variable by pressing CTRL+SHIFT+G after
placeing a cursor under a variable. 
I think much more important than this loop variable example is to get
> everyone to use 4 spaces for tabs instead of tabs which messes up SVN.
> That should be law IMO. Many people have adjusted their editors to fix
> this issue in Java but I still see this problem all over in XML and
> properties files.
Yes, I absolutely agree with you about using 4 spaces for tab. And 2 spaces
for tab in XML files, right? It would be great if you have any good XML
editor for Eclipse that I can configure 2 spaces for tab only for XML files..
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
|
|
|
|
|