Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c++ Subject: Re: Isn't sizeof an operator? Message-ID: <2352@buengc.BU.EDU> Date: 20 Mar 89 20:32:14 GMT References: <123@riunite.ACA.MCC.COM> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c++ Organization: Boston Univ. Col. of Eng. Lines: 13 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..."