Path: utzoo!attcan!uunet!know!zaphod.mps.ohio-state.edu!usc!rutgers!mcnc!thorin!degas!leech From: leech@degas.cs.unc.edu (Jonathan Leech) Newsgroups: comp.std.c++ Subject: Re: A Proposal to Extend C++ with Variable-length Arrays Message-ID: <17109@thorin.cs.unc.edu> Date: 27 Oct 90 20:33:27 GMT References: <11578@spool.cs.wisc.edu> Sender: news@thorin.cs.unc.edu Reply-To: leech@degas.cs.unc.edu (Jonathan Leech) Organization: University of North Carolina, Chapel Hill Lines: 12 In article <11578@spool.cs.wisc.edu>, bothner@sevenlayer.cs.wisc.edu (Per Bothner) writes: |> struct String { int len; char *c; } |> char *c = new char[len]; |> String *s = new String(len, c); |>But this has a number of disadvantages: |>* One extra 'new' is needed (and later an extra 'free'). |>* Extra space needed for an unnecessary pointer, plus the extra |>overhead imposed by the storage manager for an extra object. But your proposal needs extra space for the array length, so it's a wash in this respect.