Article View: gnu.g++.bug
Article #587Variable sized objects
From: Doug Lea
Date: Wed, 15 Nov 1989 11:42
Date: Wed, 15 Nov 1989 11:42
10 lines
947 bytes
947 bytes
You CAN'T make variable-sized objects if they are ever to be local (auto or static). There's just no way to do it, since in C++, the sizeof() any local must be knowable at compile time. You have to make the variable-sized thing live on the freestore, and have the `externally visible' class just a pointer to it (and also manually manage its allocation/deallocation). Libg++ Strings and a few other classes do it this way. Write me if you'd like help with the details. -Doug
Technical Details
Message-ID:
<8911151142.AA06795@g.oswego.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!G.OSWEGO.EDU!dlReferences:
<8911102130.AA22272@sperm.ocean.washington.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!tut.cis.ohio-state.edu!G.OSWEGO.EDU!dl From: dl@G.OSWEGO.EDU (Doug Lea) Newsgroups: gnu.g++.bug Subject: Variable sized objects Message-ID: <8911151142.AA06795@g.oswego.edu> Date: 15 Nov 89 11:42:25 GMT References: <8911102130.AA22272@sperm.ocean.washington.edu> Sender: daemon@tut.cis.ohio-state.edu Reply-To: dl@oswego.oswego.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 10