hardcoded constants

Barry Margolin barmar at think.COM
Thu Dec 15 03:16:47 AEST 1988


In article <1988Dec13.172306.16195 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>The policy we try to follow is that if you must hard-code a constant,
>then it must be accompanied by a comment explaining why that particular
>number is there.

My rule of thumb is that if it needs a comment, it should be a
manifest constant, not a hardcoded literal.  The name of the constant
then serves as self-documentation.

Barry Margolin
Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar



More information about the Comp.lang.c mailing list