help-bison
[Top][All Lists]
Advanced

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

Re: Growing stacks in C++


From: Hans Aberg
Subject: Re: Growing stacks in C++
Date: Fri, 23 Jul 2010 10:02:52 +0200

On 23 Jul 2010, at 01:48, Paul Hilfinger wrote:

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).

No, also since the library template function would not work without it. But the places I looked into (from before the standard) defined it explicitly. Thank you.

Anyway, I recall Paul wrote the C skeleton, and one reason for not supporting compile as C++ is that he did not want to work with C++, in addition to being complicated somehow.

  Hans





reply via email to

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