Re: Growing stacks in C++

2010-07-27 Thread Akim Demaille
Le 23 juil. 2010 à 00:00, Paul Hilfinger a écrit : Hi Paul, >>> The Bison documentation says that due to technical differences >>> between C >>> and C++, a C++ compiler wouldn't be able to compile or properly >>> execute >>> (not clear which) a Bison C program that tried to grow the parser >

Re: Growing stacks in C++

2010-07-23 Thread Paul Hilfinger
Paul Hilfinger wrote: > > BTW: I observe that ISO C++ has a template function > > std::uninitialized_copy, defined in , which ought to work for > > copying a stack properly. > Hans Aberg wrote: > The algorithm is >for (; first != last; ++result, ++first) > new (static_cast(&*

Re: Growing stacks in C++

2010-07-23 Thread Paul Hilfinger
> > 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,

Re: Growing stacks in C++

2010-07-23 Thread Paul Hilfinger
> > The Bison documentation says that due to technical differences > > between C > > and C++, a C++ compiler wouldn't be able to compile or properly > > execute > > (not clear which) a Bison C program that tried to grow the parser > > stack. What exactly is this technical difference?

Re: Growing stacks in C++

2010-07-23 Thread Hans Aberg
On 23 Jul 2010, at 18:02, Paul Eggert wrote: 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. Although I contributed to the C skeleton, I am not its original author; I bel

Re: Growing stacks in C++

2010-07-23 Thread Paul Eggert
On 07/23/10 01:02, Hans Aberg wrote: > 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. Although I contributed to the C skeleton, I am not its original author; I believe that

Re: Growing stacks in C++

2010-07-23 Thread Hans Aberg
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 t

Re: Growing stacks in C++

2010-07-22 Thread Hans Aberg
On 23 Jul 2010, at 00:00, Paul Hilfinger wrote: One problem is that the C stack does not call C++ copy constructors when reallocating. So one can only use a POD semantic value. I was indeed aware of the non-POD issue. However, this problem already prevents the use of %union in C++ files if

Re: Growing stacks in C++

2010-07-22 Thread Hans Aberg
On 23 Jul 2010, at 00:58, Paul Hilfinger wrote: BTW: I observe that ISO C++ has a template function std::uninitialized_copy, defined in , which ought to work for copying a stack properly. The algorithm is for (; first != last; ++result, ++first) new (static_cast(&*result)) typen

Re: Growing stacks in C++

2010-07-22 Thread Hans Aberg
On 21 Jul 2010, at 00:03, Paul Hilfinger wrote: The Bison documentation says that due to technical differences between C and C++, a C++ compiler wouldn't be able to compile or properly execute (not clear which) a Bison C program that tried to grow the parser stack. What exactly is this tech

Growing stacks in C++

2010-07-22 Thread Paul Hilfinger
The Bison documentation says that due to technical differences between C and C++, a C++ compiler wouldn't be able to compile or properly execute (not clear which) a Bison C program that tried to grow the parser stack. What exactly is this technical difference? Producing a C++ program using the C