🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3521

Re: The realloc question: rationale?

#3521
From: David Vandevoorde
Date: Tue, 27 Feb 1996 18:38
34 lines
2508 bytes
>>>>> "JK" == James Kanze US/ESC 60/3/141 #40763 
      <kanze@lts.sel.alcatel.de> writes:
JK> In article <xsod973w4m5.fsf@glob.cs.rpi.edu> vandevod@cs.rpi.edu
JK> (David Vandevoorde) writes:
[...]
JK> |> Since you can provide your own new operators etc., you can ensure that
JK> |> it's safe to use realloc with new/delete (or you can provide a function
JK> |> based on realloc with similar functionality).
[...]
JK> 1. It is, in fact, impossible to obtain the address actually returned
JK> by operator new[].  The implementation is allowed to (and most do) ask
JK> for extra memory in order to maintain the number of elements.
JK> Typically, this memory will be in front of the first element, so the
JK> compiler will `fix up' the address returned by operator new[] before
JK> you ever see it.

I was aware of that... which is why I didn't claim it was portable :^P
and suggested ``a function with similar functionality''.

JK> 2. The implementation is allowed to save this address in some sort of
JK> cache.  For example, an alternate implementation of a new expression
JK> for an array would be for the implementation to maintain an
JK> associative array of addresses to counts.

That's more troublesome ;-)

	Daveed
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <xsoohqlz9vu.fsf@pleiades.cs.rpi.edu>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
References: <4g903m$7g8@mari.onr.com> <4gl2ad$lqi@hermes.synopsys.com> <31301BFE.450A@onr.com> <xsod973w4m5.fsf@glob.cs.rpi.edu> <9602261740.AA28201@lts.sel.alcatel.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: vandevod@cs.rpi.edu (David Vandevoorde)
Newsgroups: comp.std.c++
Subject: Re: The realloc question: rationale?
Date: 27 Feb 1996 10:38:40 PST
Organization: RPI Computer Science
Approved: austern@isolde.mti.sgi.com
Message-ID: <xsoohqlz9vu.fsf@pleiades.cs.rpi.edu>
References: <4g903m$7g8@mari.onr.com> <4gl2ad$lqi@hermes.synopsys.com>
 <31301BFE.450A@onr.com> <xsod973w4m5.fsf@glob.cs.rpi.edu>
 <9602261740.AA28201@lts.sel.alcatel.de>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 26 Feb 1996 23:10:29 -0500
In-Reply-To: James Kanze US/ESC 60/3/141 #40763's message of 26 Feb 1996
 11:48:32 PST
X-Newsreader: Gnus v5.1
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMTNPx0y4NqrwXLNJAQE5dwIAhqR7MZ5zmHXLVMExh0/825NFvac0VpFh
 dcMRGbEXC/wvfuvIfR3wm6gsH6NG94fMQ3lfnozkiakPLMIFyRi8ZA==
 =hLTo
Originator: austern@isolde.mti.sgi.com