Re: %union with STL

2009-05-24 Thread Tommy Nordgren
C++ dont allow unions containing c++ classes On May 22, 2009, at 8:11 PM, Paritosh Aggarwal wrote: /*JIT PARSER BISON FILE*/ %{ #include #include "heading.h" using namespace std; int yyerror(char *s); int yylex(void); %} %union { pair* it; int val; } compiling this

Re: %union with STL

2009-05-24 Thread Luca
Tommy Nordgren ha scritto: C++ dont allow unions containing c++ classes I think you're wrong. The size of a pointer is always known at compile time, pair* it; is a pointer and not an object. The size is 4 bytes using a 32 bit OS. Bison union is a standard union, you can put any type inside.

Re: %union with STL

2009-05-24 Thread Tommy Nordgren
OOPS! I did not notice that the declaration was a pointer. On May 24, 2009, at 4:13 PM, Luca wrote: Tommy Nordgren ha scritto: C++ dont allow unions containing c++ classes I think you're wrong. The size of a pointer is always known at compile time, pair* it; is a pointer and not an object

Re: %union with STL

2009-05-24 Thread Hans Aberg
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* 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 def

Re: %union with STL

2009-05-24 Thread Hans Aberg
On 22 May 2009, at 20:11, Paritosh Aggarwal wrote: /*JIT PARSER BISON FILE*/ %{ #include #include "heading.h" using namespace std; int yyerror(char *s); int yylex(void); %} %union { pair* it; int val; } compiling this gives the following error: jitparser.y:15: error: