[antlr-interest] Theading Tree Walkers

Gary R. Van Sickle g.r.vansickle at att.net
Mon Feb 2 20:09:32 PST 2009


> From: Jim Idle
> 
> code_dude at nym.hush.com wrote:
> > Hi Jim,
> > Will the v3 antlr C++ module be free threading when its finally 
> > released ?
> >   
> 
> Yes, but you can use the C runtime with C++ right now.
> 
> Jim
> 

FWIW, I can confirm this works well.  Be careful with using objects as
params, return values, or in scopes though - for reasons I haven't
completely determined, it seems like you don't get your constructors called,
so you have to use a pointer-to-class and an explicit new() somewhere.  My
SWAG is that the structs used for these purposes are malloc()'ed, hence no
object construction.

Hmmm....

"#ifdef __cplusplus
// We're being compiled as C++
NEW_SCOPE	new ScopeStruct()
#else
// We're in C
NEW_SCOPE	malloc(sizeof(ScopeStruct))
#endif

ScopeStruct the_scope = NEW_SCOPE;"

...?

-- 
Gary R. Van Sickle



More information about the antlr-interest mailing list