The C language provides a minimal, efficient framework. A key to writing bug-free code is learning from your mistakes. Designing a module right the first time saves time. Programming without a goal is like a sailboat without a sail. You drift. Never reinvent the wheel. Always code what to do, not how to do it. As a general rule, try to keep functions under one page.
Always review changes before checking source code back in. An API must be designed right the first time because changes to an API are costly. Before you can write bug-free code, you must have a bug-free, rock-solid base. Provide a code wrapper around all system calls. Use macros as an aid to porting so that your code base does not change at all. Try to hide how something works to provide an abstraction that aids.
Always review changes before checking source code back in. An API must be designed right the first time because changes to an API are costly. Before you can write bug-free code, you must have a bug-free, rock-solid base. Provide a code wrapper around all system calls. Use macros as an aid to porting so that your code base does not change at all. Try to hide how something works to provide an abstraction that aids.
Macro names should be in uppercase. Macros beginning with an underscore are to be used only in other macros, not explicitly in source code. New data types should be in uppercase. New data types must be declared with a typedef statement, not a macro definition. Variables should be named using Hungarian notation. Hungarian notation allows you to know a variable's data type without seeing the data declaration. Functions should be named using the module/verb/noun convention. Think twice and do once.
If I had eight hours to chop down a tree,
I'd spend six hours sharpening my axe. -- AbrahamLincoln
--
Sam