bison-patches
[Top][All Lists]
Advanced

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

Re: FYI: default %printer/%destructor


From: Hans Aberg
Subject: Re: FYI: default %printer/%destructor
Date: Mon, 20 Nov 2006 16:02:06 +0100

On 19 Nov 2006, at 23:54, Joel E. Denny wrote:

On Sun, 19 Nov 2006, Hans Aberg wrote:

The %destructor is only needed with output language C.

Currently, it's also useful for C++.

You mean, of one writes code in the common C/C++ subset. :-)

I think you, Akim, and I have all agreed that semantic types cannot have C++ destructors given Bison's current C++ skeletons. You need % destructor
instead.  That's what I'm referring to.

I should be more careful. I'm thinking of when you use %union with the
C++ skeletons.  I have not tried the #define YYSTYPE approach, but I
recall someone reporting using C++ destructors then.

The problem with %union is that it implements a 'union', which in C++ cannot be used with non-PODs, essentially, classes with non-trivial (or user-defined) destructors. So, therefore, instead use something else, plus a method to select dynamics objects.

Anyway, my point is that %destructor can be useful with Bison's current
C++ skeletons.

If one really does not want to use one of the main advantages of C++, classes with constructors and destructors. I am not sure why one is not using C in such a case. :-)

  Hans Aberg






reply via email to

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