Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!bionet!bloom-beacon!tut.cis.ohio-state.edu!DSYS.NCSL.NIST.GOV!rbj From: rbj@DSYS.NCSL.NIST.GOV (Root Boy Jim) Newsgroups: gnu.g++.bug Subject: size of empty classes Message-ID: <8908141613.AA23693@dsys.ncsl.nist.gov> Date: 14 Aug 89 16:13:26 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: National Institute of Standards and Technology formerly National Bureau of Standards Lines: 22 ? From: chatty%FRLRI61.BITNET@cunyvm.cuny.edu ? I just discovered that an empty class has a non-null size. Is that ? intentional? If it is, what are those 2 bytes for? Until now, I ? thought having an empty base class was for free. I am disappointed. ? I use g++ 1.35.1- on a Sun3 running OS 3.5. Just a bit of speculation here. I hope you don't think all that whiz-bang object-oriented stuff comes for free. Most likely those two bytes are a pointer into some table telling you what class the thing really is. Remember that when deriving one class from another, some means of dynamically determining to which class an object belongs must be provided. The higher level the language, the farther you get from what the thing really is. Live with it. ? Stephane Chatty chatty@frlri61.bitnet, chatty@lri.lri.fr ? LRI, Universite d'Orsay ? Orsay, FRANCE Root Boy Jim Have GNU, Will Travel.