help-bison
[Top][All Lists]
Advanced

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

Re: C++ / multiple instances / iostreams


From: Hans Aberg
Subject: Re: C++ / multiple instances / iostreams
Date: Tue, 27 Jul 2004 19:43:18 +0200

At 22:21 +0200 2004/07/26, Detlef Vollmann wrote:
>> I might then change back and use the std::deque (or std::stack which uses
>> the deque) as default for the Bison parser stack then.
>std::stack probably doesn't provide the interface that's
>required for a parser stack: you can always only access
>the top element of the stack.
>That's why I used deque.

I realized that too, but I thought I should wait for your reply first. :-)

Actually, the most efficient parser stack would probably be chunks that do
not cross the rule boundaries.

>I think [vectors implemented as arrays is] an important thing: the
>standard requires three
>different implementations for dynamic sequential containers,
> - a contiguous piece of memory (vector)
> - single elements linked together (list)
> - larger chunks of memory, transparently linked together (deque)
>While vector and list arguably name more or less their
>implementation, deque names essentially the interface, which
>is IMHO a bit unfortunate.
>
>As you wrote, it's easy in C++ to put any interface on top of
>those implementation, but it's important that every C++
>implementation provides those basic implementation facilities.

The C++ standard is a bit schizoid, attempting to follow the original C
standard, where the underlying implementation is not indicated, not
shutting out various hardware architectures. Then it becomes funny when one
imposes conditions that in effect forces a type of implementation. And not
even C99 could anymore shun away from this path, as one, for example, now
can indicate integral types with sizes.

There is no particular point in requiring a particular implementation, if
there is no way one can take advantage of it. In the case of std::vector,
one still has to use the interface, so it makes no difference how it is
implemented. As C++ implements user types which must wholly be accessed via
the interface, the different types, array, list, and deque, only differ in
complexities; they could otherwise have been given the same interface. This
is just another place in the C++ standard where one has a wishy-washy
attitude.

  Hans Aberg






reply via email to

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