[antlr-interest] On the guessing mode in C++

Andrey R. Urazov a_urazov at mail.ru
Fri Apr 30 08:51:43 PDT 2004


Hi,

The current implementation of the guessing mode in C++ guarantees that
all the user defined actions be ignored. In my opinion the same
requirement should be spread onto the return values --- return values
should never be assigned in guessing mode. Otherwise, undesired side
effects are possible which may be caused by overloaded assignment
operators.

Now, for example, I have a situation described by the following
simplistic example:

rule1
{
    std::string s;
}
:
    s = rule2
;

rule2 returns [char* result]
{
    static char buf[BUFF_SIZE];
}
:
    x
    {
        strcpy(buf, y);
        result = buf;
    }
;

When in guessing mode `buf' is not initialized and may contain any
trash but the zero value thus causing assignment `s = rule2' to crash.

Best regards,
  Andrey Urazov



 
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