help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Growing stacks in C++


From: Paul Hilfinger
Subject: Re: Growing stacks in C++
Date: Thu, 22 Jul 2010 16:48:13 -0700

 > > That's not what this means.  The 'new' operator here uses the standard
 > > placement form, which does no allocation, but uses the given address
 > > (result) as the pointer value, invoking the copy constructor
 > > (value_type(*first)) on it.  This is indeed the desired behavior.
 > 
 > Yes, sorry. From what I see (cf. 12.14.13), one may have to define
 >    void* operator new(size_t, void* p) { return p; }
 > Or is it in the standard?


It is standard:

   18.4.1.3: Placement forms

   These functions are reserved, a C++ program may not define functions
   that displace the versions in the Standard C++ library (17.4.3).

        void* operator new(std::size_t size, void* ptr) throw();

Not surprising, really, since the function does nothing whatever except
return ptr (calling the copy constructor is part of the semantics of the
'new' expression, as opposed to this operator).

Paul Hilfinger



reply via email to

[Prev in Thread] Current Thread [Next in Thread]