Path: utzoo!attcan!uunet!nuchat!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: hardcoded constants Message-ID: <2484@ficc.uu.net> Date: 18 Dec 88 05:42:12 GMT References: <1988Dec8.173158.11839@utzoo.uucp> <846@starfish.Convergent.COM> <735@auspex.UUCP> Organization: SCADA Lines: 16 In article <735@auspex.UUCP>, guy@auspex.UUCP (Guy Harris) writes: > >How about sizeof "/"? Or does that return sizeof(char *)? > > No, it returns the number of bytes in the anonymous character array that > "/" is.... [Which is 1+#chars, since the null is included] #define STRLEN(s) (sizeof s - 1) #define NULLEN 1 > strlen(a) + sizeof "/" + strlen(b) + sizeof "/" + strlen(c) strlen(a) + STRLEN("/") + strlen(b) + STRLEN("/") +strlen(c) + NULLEN -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net.