hardcoded constants

Peter da Silva peter at ficc.uu.net
Sun Dec 18 15:42:12 AEST 1988


In article <735 at auspex.UUCP>, guy at 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 at ficc.uu.net, +1 713 274 5180.
Home: bigtex!texbell!sugar!peter, peter at sugar.uu.net.



More information about the Comp.lang.c mailing list