help-bison
[Top][All Lists]
Advanced

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

Re: accessing yyval outside lex and yacc


From: Axel Kittenberger
Subject: Re: accessing yyval outside lex and yacc
Date: Sat, 21 Jul 2001 18:32:50 +0200 (MEST)

> Bison implements %union as a C/C++ union, and those unions cannot hold
> data
> of user defined classes (specifically, with their own explicit
> constructors). So if one wants to use such user defined classes, the Bison
> %union feature goes down the drain.

Äooking at c globally I don't see all what 'union' has an advantage against
nomral typecasts, same goes for bison where union is only internally used,
why not simply make directly typecasts at output?

union TOKEN {
  int i;
  char *s;
}

Normally a rule would aprox. look like this:
token1.i = strlen(token2.s);

what's the advantage against having the generator generate:
(int) token1 = strlen( (char *) token2);

Okay fair question would be what's the advantage doing it this way? You'll
save the union defintion, and don't know for sure, would it help for your c++
problems? 

- Axel

-- 
    
                                 

GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

GMX Tipp:

Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1!
http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a




reply via email to

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