If you need more than 3 levels of indentation, you're screwed?
Posted
by
jokoon
on Programmers
See other posts from Programmers
or by jokoon
Published on 2011-02-27T17:46:58Z
Indexed on
2011/03/10
8:18 UTC
Read the original article
Hit count: 206
Per the Linux kernel coding style document:
The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.
What can I deduct from this quote? On top of the fact that too long methods are hard to maintain, are they hard or impossible to optimize for the compiler?
I don't really understand if this quote encourages better coding practice or is really a mathematical / algorithmic sort of truth.
I also read in some C++ optimizing guide that dividing up a program into more function improves its design is a common thing taught at school, but it should be not done too much, since it can turn into a lot of JMP calls (even if the compiler can inline some methods by itself).
© Programmers or respective owner