[antlr-interest] static casts in heterogeneous AST parser

John Lambert johnl at jbase.com
Mon Oct 8 12:35:27 PDT 2001


Ric,

My AST is derived from BaseAST, do you think that should make any
difference?

JOhn


-----Original Message-----
From: Ric Klaren [mailto:klaren at cs.utwente.nl]
Sent: Monday, October 08, 2001 12:29 PM
To: antlr-interest at yahoogroups.com
Subject: Re: [antlr-interest] static casts in heterogeneous AST parser


On Mon, Oct 08, 2001 at 09:06:02AM -0700, John Lambert wrote:
> I have problems compiling a parser using heterogeneous ASTs on HPUX.
> 
> It is objecting to all  static_cast operations between ASTRefcount<AST>
and
> ASTRefcount< derivedAST> 

Is your ast type derived from CommonAST ?

> HP support claim they are correct and that it should be a
reinterpret_cast.
> I disagree, this works fine on lots of other platforms and a quick test of
> reinterpret_cast on other platforms produces compilation errors.

If I read the spec correctly the Refcount structure is structurally the
same for both types and the cast should be valid. So far all compilers had
no trouble with this code so I'm surprised... 

I still have to test Ruslan's implementation, so there might be some
changes in the future that might affect this positively.

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++----
---
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++----
---
     Human beings, who are almost unique in having the ability to learn
   from the experience of others, are also remarkable for their apparent
         disinclination to do so. --- Douglas Adams, Last Chance to See


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list