hardcoded constants
Chip Salzenberg
chip at ateng.ateng.com
Thu Dec 22 04:39:10 AEST 1988
According to henry at utzoo.uucp (Henry Spencer):
>Trouble is, often it's almost impossible to devise a meaningful name.
>I'm not talking about hard-coding things like choice of control characters,
>but about things like (in a function to concatenate two strings with a
>'/' in between):
>
> foo = malloc(strlen(a)+strlen(b)+2); /* 2 for '/' '\0' */
Not hard:
foo = malloc(strlen(a)+sizeof("/")+strlen(b));
--
Chip Salzenberg <chip at ateng.com> or <uunet!ateng!chip>
A T Engineering Me? Speak for my company? Surely you jest!
"It's no good. They're tapping the lines."
More information about the Comp.lang.c
mailing list