Use register variables where needed.
Hash table sizes should be in powers of 2; field
sizes of variables should also be in powers of 2.
Where possible, use local variables to help the
optimizer promote variables to registers.
When using short
or char variables
or bit-fields, it is more efficient to use unsigned variables rather
than signed because a signed variable causes an extra instruction
to be generated.
The code generated for a test for a loop termination
is more efficient with a test against zero than for a test against
some other value. Therefore, where possible, construct loops so
the control variable increases or decreases towards zero.
Do
loops and for
loops are more efficient than while
loops because opportunities for removing loop invariant code are
greater.
Whenever possible, pass and return pointers to large
structs instead
of passing and returning large structs
by value.
Do shift, multiplication, division, or remainder
operations using constants instead of variables whenever possible.
Insure all local variables are initialized before
they are used.
Use type checking tools like lint
to help eliminate semantic errors.