[antlr-interest] Re: ANTLR 2.7.4: C++ grammar

David Wigg wiggjd at lsbu.ac.uk
Mon Dec 6 05:11:01 PST 2004


Hello Francis,

Thanks for your message about run time errors with the generated 
C++ compiler from our C++ parser CPP_parser.g.

This is a new problem for me which may have surfaced because 
MSVC 7.1 is more strict than previous versions. We need to 
clarify the new situation as it could have implications for all 
grammars.

A similar problem was quoted by jimmyatwork1 at yahoo.com in 
antlr-interest digest no. 1893 on 2 December. This was for char 
*s in scope_override.

I wonder if this problem is picked up during a run in those 
cases where a potential definition of an uninitialised pointer 
to character has been bypassed by selection in non guessing mode?

What effect does this problem have? Is it just a warning or does 
it stop the run?

My understanding is that pointer to character would be 
automatically initialised to a null pointer.

If I am correct then a return value of null should not 
necessarily be a problem. (It could be correct?)

If so, then MSVC 7.1 must mark these variables specially when 
initialised (even with null).

Does this mean that to be on the safe side that when we specify 
a return value in a production we should initialise it?

For example,

qualified_ctor_id returns [char *q = '';]

So far the problem seems to have arisen only with pointers to 
characters. What about other sorts of pointers and integers etc.?

David.






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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





More information about the antlr-interest mailing list