[comp.lang.c] crazy micro-optimizations

flaps@dgp.toronto.edu (Alan J Rosenthal) (10/26/88)

In article <207600005@s.cs.uiuc.edu> carroll@s.cs.uiuc.edu writes:
>This bug shows up in 'units', where the exponents are stored in chars,
>*signed* chars.  On a 3b [where 'char' is unsigned], this means that
>'units' can't deal with negative powers of dimensions ...
>Although there is a simple fix (change 'char' to 'short int'), ...

A much better fix, generally speaking, would be to cut out this kind of
micro-optimization, which just makes programs buggy, and say "int" if you mean
an integer, unless you have some serious reason to do otherwise.  shorts are
probably slower than ints anyway, and those extra two bytes you're trying to
save (on some machines only; often ints and shorts are the same) will quite
possibly be wasted due to alignment anyway.  So your program will be longer,
slower, and buggier.