Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ptsfa!ihnp4!homxb!houxm!mtuxo!mtgzz!bds From: bds@mtgzz.UUCP Newsgroups: comp.sys.atari.st Subject: Re: sizeof("string") Message-ID: <2607@mtgzz.UUCP> Date: Tue, 14-Apr-87 09:25:38 EST Article-I.D.: mtgzz.2607 Posted: Tue Apr 14 09:25:38 1987 Date-Received: Sun, 19-Apr-87 05:37:43 EST References: <8704120143.AA11235@cory.Berkeley.EDU> <2006@ihuxz.ATT.COM> Organization: AT&T, Middletown NJ Lines: 17 Summary: A suggestion. I strongly recommend using either of the constructs: static char xyz[] = "string"; /* at some point later in your code */ ... sizeof xyz ... /* no overhead in using the symbol: xyz */ OR ... sizeof (char *) ... Depending on what result you are looking for. Note: (sizeof xyz) == (strlen(xyz) + 1) in THIS case. After all, I could set xyz[0] = '\0', and the equality will not hold. Remember: sizeof does not generate any run time code (unlike the strlen); it is evaluated at compile time.