Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!lll-lcc!lll-winken!gauss.llnl.gov!casey From: casey@gauss.llnl.gov (Casey Leedom) Newsgroups: comp.windows.x Subject: Re: stupid C question Message-ID: <16172@lll-winken.UUCP> Date: 2 Jan 89 02:15:34 GMT References: <8812300028.AA17754@EXPO.LCS.MIT.EDU> <4543@xenna.Encore.COM> <16124@lll-winken.UUCP> <4552@xenna.Encore.COM> Sender: usenet@lll-winken.UUCP Reply-To: casey@lll-crg.llnl.gov.UUCP (Casey Leedom) Organization: Lawrence Livermore National Laboratory Lines: 19 | From: bzs@Encore.COM (Barry Shein) | | | From: Casey Leedom | | | | In some ways interpreting sizeof("...") to be sizeof(char *) would be | | more consistent, but certainly less useful. | | Based on that reasoning we would expect for: ``int a[10];'' sizeof(a) to | be sizeof(int *)? [Sizeof is not a subroutine, it's an operator.] Thus, | it can have its own semantics, and does, you're looking for consistency | where none is needed. Right as usual Barry. I should have remembered that the basic semantic meaning of ``sizeof foo'' is size of the OBJECT foo. Sizeof (char *), etc. is just asking what the size of an abstract OBJECT of type (char *), etc. would be. Thus sizeof(char [10]) returns 10 for the abstract OBJECT which is an array of 10 characters. Casey