Article View: comp.std.c++
Article #561Re: A Proposal to Extend C++ with Variable-length Arrays
From: Jonathan Leech
Date: Sat, 27 Oct 1990 20:33
Date: Sat, 27 Oct 1990 20:33
12 lines
1062 bytes
1062 bytes
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.
Technical Details
Message-ID:
<17109@thorin.cs.unc.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!know!zaphod.mps.ohio-state.edu!usc!rutgers!mcnc!thorin!degas!leechReferences:
<11578@spool.cs.wisc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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