Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!tut.cis.ohio-state.edu!ukma!husc6!purdue!decwrl!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c Subject: Re: hardcoded constants Message-ID: <1119@goofy.megatest.UUCP> Date: 23 Dec 88 05:27:01 GMT References: <77@attibr.UUCP> Organization: Megatest Corporation, San Jose, Ca Lines: 24 From article <77@attibr.UUCP>, by vch@attibr.UUCP (Vincent C. Hatem): > > Last I heard sizeof("/") == sizeof(char *) - which is almost never 2, and > NEVER portable. > First I heard sizeof("/") == 2 which is sometimes sizeof(char*), and ALWAYS portable. On my machine, a 68020 based Sun3/60, sizeof(char*) seems to be either four or seven, depending. Don't feel bad. I blew sizeof('\0') bigtime. % cat foo.c main() { printf("%d %d\n", sizeof(char*), sizeof ("foobar")); exit(0); } % cc foo.c % a.out 4 7