Coding: Sizes
Functions and files should be kept short, for the sake of easy reading, fast
recompilation, etc. Recommended breakpoints:
- Functions should be 500 lines or less. 60 lines or less would be very
much preferred, with 120 another breakpoint, to fit on printed pages.
- Files should not exceed 5000 lines or 100k.
- Lines should not exceed 132 columns. 79 columns or less is very much
preferred. (Why not 80? Because the "type" and "more" commands, and their
equivalents under other OSes, often force an extra line break at column 80.)
- Individual loop/conditional bodies should also be kept to 60 lines or
less.
Remember to extract anything that is repeated often, into a function that can
be called from multiple places. (Of course there are exceptions, such as code
that MUST run at absolute maximum speed and thus cannot afford the minor
overhead of a function call.)