|
From: | Hans Aberg |
Subject: | Re: too many warnings from Bison CVS for Pike |
Date: | Wed, 22 Feb 2006 01:11:29 +0100 |
On 21 Feb 2006, at 19:34, Joel E. Denny wrote:
If this usage is fine, then I wonder how "lalr1.cc" supports non- POD typesmore than "yacc.c". A footnote in the same section says that `pseudo-unions' may alleviate this need for pointers in the future.
I just use a C++ polymorphic variable, created by a class hierarchy where all classes are derived from a root class with a reference count in it, to avoid unnecessary copying. Then the semantic type is a non-POD class maintaining a dynamically moving pointer to this class hierarchy. Type conversions are done using dynamic_cast, which calls for runtime conversions, but I think one should be able to use Bison's static type system to make these conversions using static_cast instead, thus computable at compile time. This is sort of the C++ variation of doing the same thing in C.
Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |