Topic: Is "new" with a placement argument part of the standard??


Author: pete@borland.com (Pete Becker)
Date: Sat, 6 Mar 1993 01:19:33 GMT
Raw View
In article <1n8qvjINNqel@elroy.jpl.nasa.gov> hartzman@kilroy.Jpl.Nasa.Gov (Les Hartzman) writes:
>In the C++ Primer, 2nd Ed. (S. Lippman), pg. 149-150 is an example of
>allocating an object on predefined chunk of memory.  I would like to use this
>feature to place class data into shared memory.
>
>The Borland C++ compiler (OS/2) does not allow for the placement syntax.  Is
>this syntax part of the ANSI draft?  Should they be supporting it?  Or do I
>always have to roll my own?
>

 BC++ most certainly DOES allow the placement syntax. What it doesn't
provide is a predefined global operator new(size_t, void *) to automagically
let you build things in predefined memory areas. That's a one-liner that
you can easily write yourself:

 inline void *operator new( size_t, void *arena )
 {
 return arena;
 }

 -- Pete