Array indexing vs. pointers...

Henry Spencer henry at utzoo.uucp
Thu Oct 6 06:47:11 AEST 1988


In article <1700 at dataio.Data-IO.COM> bright at dataio.Data-IO.COM (Walter Bright) writes:
>    o	Replace int variables with unsigned where possible. This tells the
>	optimizer that the variable can never be negative...

This can be a mistake on some machines, and I'm not sure how it would help
very often.

>    o	... Use calloc instead of
>	malloc followed by zeroing each member.

Mistake -- the semantics are not the same.  Calloc fills with zero bits;
that is not necessarily the same thing as zero values, especially for
floating-point and pointers.
-- 
The meek can have the Earth;    |    Henry Spencer at U of Toronto Zoology
the rest of us have other plans.|uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list