Re: [suse-programming-e] Advice on a style issue(writing funcions)
This is advice that's often offered, and like all advice it >shouldn't be followed slavishly - it really depends on the circumstances. At it's >worst it results in horriblely dense and unreadable code as the programmer >tries to make what he wants fit into one screen. At its best it encourages
Hi all, I agree with Alan, with one added note. Its been my experience that you never want to make a source code file too big either. On some of the old UNIX C compilers, they refuse to compile these "large" source code files. So, to get around this you have to do ugly things like log in as root and use ulimit -v unlimited. Not good, especially if you are on a clients machine and don't have root access. Also avoid using global variables if at all possible. Its hard tracking down side-effects in a program if you do. Its also very hard to prove a large C program correct in that case. programmers to think about what they are putting in to their functions.
I would have said that a better piece of advice would be to suggest >>that functions should only do one thing, unless they are higher level functions, in which case they should call a series of functions, >>each of which does one thing. If you follow this, then your functions will generally only take up a relatively small number of lines without >>having to artificially squash them down.
_______________________________________________ Join Excite! - http://www.excite.com The most personalized portal on the Web!
participants (1)
-
Nicholas Parsons