hardcoded constants

Jeff Barr jeff at amsdsg.UUCP
Thu Dec 22 07:47:12 AEST 1988


In article <883 at quintus.UUCP>, ok at quintus.uucp (Richard A. O'Keefe) writes:
> henry at utzoo.uucp (Henry Spencer) writes:
> >-	foo = malloc(strlen(a)+strlen(b)+2);	/* 2 for '/' '\0' */
> >-Now, what's a good name for that "2", and how does naming it improve
> >-readability?
> 
> I recently had a very similar problem.  A *superb* "name" for that 2 is
> 		sizeof "/"

(*superb*)?  Personally, I don't see any connection.  I'd rather use 

			(sizeof ("")) 
			
to indicate the overhead (if you will) to store a string.

							Jeff
-- 
	 /-------------------------------------------------------\
	/  Jeff Barr   AMS-DSG   uunet!amsdsg!jeff   800-832-8668 \
	\  American Express: "Don't leave $HOME without it".	  /
	 \-------------------------------------------------------/



More information about the Comp.lang.c mailing list