Path: 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 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