On Thu, 9 Feb 2006 [EMAIL PROTECTED] wrote:

> Dynamic C-parserstack. This is what is Bison implements if  
> __cplusplus is not defined. However, this should work under C++ as  
> well for POD types. By the segment:
> 
> #if (! defined (yyoverflow) \
>       && (! defined (__cplusplus) \
>        || (defined (YYLTYPE_IS_TRIVIAL) && YYLTYPE_IS_TRIVIAL \
>               && defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
> 
> /* A type that is properly aligned for any stack member.  */
> union yyalloc
> {
>    short int yyss;
>    YYSTYPE yyvs;
>      YYLTYPE yyls;
> };
> ...
> 
> you already have a test against non-POD types, as these cannot be  
> used in a union. So if one would want to use this dynamic stack with  
> a POD type, just remove the (! defined (__cplusplus) above.

I'm getting a little lost in this thread, so forgive me if I'm 
repeating....  Why is it necessary to remove the ! defined (__cplusplus)?  
If %union is defined, then YYSTYPE_IS_TRIVIAL.  If also 
YYLTYPE_IS_TRIVIAL, then union yyalloc and YYSTACK_RELOCATE() will be 
defined.  In this case, defined(__cplusplus) is irrelevant.

Am I missing something?

> But one might supply a macro, say CPP_SEMANTIC_POD, which signals  
> that the C++ semantic type is a POD, and that the dynamic C- 
> parserstack should be used.

%union seems to be enough.

Joel


Reply via email to