Path: utzoo!attcan!uunet!husc6!rutgers!ucsd!chem.ucsd.edu!tps From: tps@chem.ucsd.edu (Tom Stockfisch) Newsgroups: comp.lang.c Subject: Re: hardcoded constants Message-ID: <386@chem.ucsd.EDU> Date: 21 Dec 88 23:25:16 GMT References: <1988Dec8.173158.11839@utzoo.uucp> <846@starfish.Convergent.COM> <9134@smoke.BRL.MIL> <1988Dec13.172306.16195@utzoo.uucp> <5146@bsu-cs.UUCP> <1988Dec15.190331.2986@utzoo.uucp> Reply-To: tps@chem.ucsd.edu (Tom Stockfisch) Organization: Chemistry Dept, UC San Diego Lines: 14 In article <1988Dec15.190331.2986@utzoo.uucp> 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? In this case I usually write foo = malloc( strlen(a) + strlen(b) + sizeof("/") ); What do you think of that? -- || Tom Stockfisch, UCSD Chemistry tps@chem.ucsd.edu