CCoding Style - Use short names for Locals
Revision as of 09:30, 23 June 2015 by Jshankar (1 revision imported: EdWiki -- Emsys pages from Shukra)
Use short names for Locals
- Programmers are often encouraged to use long variables names regardless of context. That is a mistake. Clarity is achieved through brevity.
for( theElementIndex = 0; theElementIndex < numberOfElements; theElementIndex++ ) elementArray[theElementIndex] = theElementIndex; for( i = 0; i < nelems; i++ ) elem[i] = i;
- Short names suffice for local variables; within a function, n may be sufficient, npoints is fine and numberOfPoints is overkill.