[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C++ parser and exceptions in semantic actions
From: |
John Horigan |
Subject: |
C++ parser and exceptions in semantic actions |
Date: |
Tue, 23 Feb 2010 11:12:05 -0800 |
My C++ bison parser has try/catch blocks sprinkled all over the semantic
actions, but the catch block always does the same thing:
try {
... stuff ...
} catch (CfdgError e) {
error(e.where, e.what);
YYABORT;
}
I use auto_ptrs to clean-up stray objects. I would like to get rid of all of
these try/catch blocks and just have a single one around the parse() method:
try {
yyresult = parser.parse();
} catch (CfdgError e) {
driver.error(e.where, e.what);
}
But I am worried that the C++ parser might leak objects if I throw an exception
all the way out of the parse() method. Can any bison developer tell me whether
any objects are leaked if I throw an exception out of the parse() method and
then delete the parser? Thanks.
-- john
- C++ parser and exceptions in semantic actions,
John Horigan <=