On Tue, 21 Feb 2006, Akim Demaille wrote:

> People, like me
> years ago, know that you can have C code manipulate C++ structures
> properly as long as they are PODs.  Trying to use non PODs in
> yacc.c is not supported, that's the role of lalr1.cc.  I'll
> write a piece of documentation about this.

Section `10.1.2 C++ Semantic Values' explains that only *pointers* to 
non-POD types can be used in %union for "lalr1.cc" and that %destructor is 
needed to prevent memory leaks.  I've been doing the same for "yacc.c".  
I've talked to others who do this as well, but I've not searched for 
online references to this usage.  If this usage is somehow an abuse of 
"yacc.c", a note about it might be helpful in the documentation.

If this usage is fine, then I wonder how "lalr1.cc" supports non-POD types 
more than "yacc.c".  A footnote in the same section says that 
`pseudo-unions' may alleviate this need for pointers in the future.  So, 
are you referring to future plans rather than current support?

Joel


Reply via email to