help-bison
[Top][All Lists]
Advanced

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

Re: %union with STL


From: Hans Aberg
Subject: Re: %union with STL
Date: Sun, 24 May 2009 17:55:34 +0200

On 24 May 2009, at 16:13, Luca wrote:

C++ dont allow unions containing c++ classes
I think you're wrong. The size of a pointer is always known at compile time, pair<const string,int>* it; is a pointer and not an object. The size is 4 bytes using a 32 bit OS.

The problem is what the C++ standard really defines. I recall 'union's can only contains POD (plain old data), which is defined as types built from the C subset. The new C++ will extend this definition.

But you can use void* and cast to this type. The Bison type-system does not work with proper C++ casting involving function calls anyway.

  Hans






reply via email to

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