Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!snorkelwacker!apple!usc!cs.utexas.edu!tut.cis.ohio-state.edu!SPERM.OCEAN.WASHINGTON.EDU!keffer From: keffer@SPERM.OCEAN.WASHINGTON.EDU (Tom Keffer) Newsgroups: gnu.g++.bug Subject: re: Variable sized objects Message-ID: <8911151720.AA05328@sperm.ocean.washington.edu> Date: 15 Nov 89 17:20:28 GMT References: <8911151142.AA06795@g.oswego.edu> Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 28 dl> Date: Wed, 15 Nov 89 06:42:25 EST dl> From: dl@g.oswego.edu (Doug Lea) dl> Reply-To: dl@oswego.oswego.edu dl> You CAN'T make variable-sized objects if they are ever to be local dl> (auto or static). There's just no way to do it, since in C++, the cl> sizeof() any local must be knowable at compile time. You have to make dl> the variable-sized thing live on the freestore, and have the dl> `externally visible' class just a pointer to it (and also manually dl> manage its allocation/deallocation). Libg++ Strings and a few other dl> classes do it this way. Write me if you'd like help with the details. dl> -Doug This is, of course, the way I am doing it (even I know THAT ! :-). But, it seems that I can't even do it on the freestore unless I assign to "this", a la Stroustrup, p. 165, and that ain't allowed any more with plain vanilla g++ 1.36 (you must specify the -fthis-is-variable flag and take the resultant performance hit). -tk --- Dr. Thomas Keffer | Internet: keffer@ocean.washington.edu Rogue Wave Assoc. | BITNET: keffer%ocean.washington.edu@UWAVM Seattle, WA 98145 | uucp: uw-beaver!ocean.washington.edu!keffer (206) 523-5831 | Telemail: T.KEFFER/OMNET