Path: utzoo!attcan!uunet!amsdsg!jeff From: jeff@amsdsg.UUCP (Jeff Barr) Newsgroups: comp.lang.c Subject: Re: hardcoded constants Summary: Hardcoded numbers Message-ID: <180@amsdsg.UUCP> Date: 21 Dec 88 21:47:12 GMT References: <15852@iuvax.cs.indiana.edu> <883@quintus.UUCP> Organization: AMS Departmental Systems Group, Arlington, VA Lines: 21 In article <883@quintus.UUCP>, ok@quintus.uucp (Richard A. O'Keefe) writes: > henry@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". / \-------------------------------------------------------/