Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: Re: hardcoded constants Message-ID: <270@twwells.uucp> Date: 23 Dec 88 10:53:00 GMT References: <2636@m2-net.UUCP> <1104@goofy.megatest.UUCP> <267@twwells.uucp> <410@aplcen.apl.jhu.edu> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 19 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <410@aplcen.apl.jhu.edu> arrom@aplcen.UUCP (Ken Arromdee (600.429)) writes: : >How about sizeof('\0') is equal to the size of an integer, which is : >unlikely to be 1? : >Remember, in C, character constants are integer constants. : : I was under the impression that "sizeof" is done at compile time and isn't : really a function, so this would correctly return 1. Well, you are right that sizeof is done at compile time, and it isn't a function. But it won't return 1. Sizeof is an operator. The thing it is operating on is a character constant. In C, a character constant *is* an integer. Thus sizeof a character constant must the the same as the sizeof an integer. (Now, for the gurus: am I right in saying integer, or should I say `of some integral type'?) --- Bill {uunet|novavax}!proxftl!twwells!bill