Path: utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!yahi.stanford.edu!mdt From: mdt@yahi.stanford.edu (Michael Tiemann) Newsgroups: gnu.g++ Subject: Isn't sizeof an operator? Message-ID: <8903202240.AA24954@yahi> Date: 20 Mar 89 22:40:25 GMT References: <2352@buengc.BU.EDU> Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@lurch.stanford.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 18 In article <123@riunite.ACA.MCC.COM> rfg@riunite.UUCP (Ron Guilmette) writes: ["why isn't sizeof declarable as an operator?"] Because it's a compiler directive, not a C-language operator. The result of sizeof (something) is an integer _constant_. If you try to take the size of something that has a varying size, you will get only the size of that thing at compile time. If you're creating varying-sized data elements, you should keep track of their sizes yourself. --Blair "But I don't know why you would..." It also takes a TYPE as an argument instead of an EXPRESSION. Michael