Article View: gnu.g++.bug
Article #507sizeof(Class) vs. size passed to Class::new
From: Dirk Grunwald
Date: Tue, 17 Oct 1989 18:41
Date: Tue, 17 Oct 1989 18:41
16 lines
1034 bytes
1034 bytes
If you define an overloaded new, you're passed the size of the structure you are to allocate. In the latest g++.xtar.Z, this differs from the value returned via ``sizeof'' for that class. Is this intentional? For example, in one class I have, operator new is passed a size of 183 while sizeof returns 176. Does the sizeof() operator omit space for vtable pointers? Why 7 bytes different? Is this a bug or a feature? Dirk Grunwald -- Univ. of Colorado at Boulder (grunwald@foobar.colorado.edu)
Technical Details
Message-ID:
<8910171841.AA07303@foobar.colorado.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!uakari.primate.wisc.edu!gem.mps.ohio-state.edu!rpi!tut.cis.ohio-state.edu!FOOBAR.COLORADO.EDU!grunwaldShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!uakari.primate.wisc.edu!gem.mps.ohio-state.edu!rpi!tut.cis.ohio-state.edu!FOOBAR.COLORADO.EDU!grunwald From: grunwald@FOOBAR.COLORADO.EDU (Dirk Grunwald) Newsgroups: gnu.g++.bug Subject: sizeof(Class) vs. size passed to Class::new Message-ID: <8910171841.AA07303@foobar.colorado.edu> Date: 17 Oct 89 18:41:35 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: grunwald@foobar.colorado.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 16