Mail Archives: djgpp/1997/04/16/23:05:03
> point, if it was there. of course, your suggestion now begs the question:
> do i need to explicitly declare:
>
> %token <dval> name
> ..
> ..
> %type <dval> expression
>
> in the case that my union has a single type member, or is
> understood by default? i will check it out soon
I think that for union declarations in C ( independent of Yacc )
any time you reference a variable of a union type without specifying
a particular union member it defaults to the first defined member type
so for
union foo_u {
double dval;
long int lval;
};
union foo_u bar;
bar = 5.6;
and
bar.dval = 5.6;
are treated the same way. So, I think it will work for you without
explicit declarations, but I would say its could practice to explicitly
declare them if your default type isn't int.
Andrew
- Raw text -