ANTLR3 C Target with C++ Exceptions -


i have experience antlr 2's c++ target, have been hesitant spend time on antlr 3 because of fears exception safety.

sadly, antlr 3 has c target produces c "c++ compatible." not seem include c++ exception safety, based on following:

you can use [exceptions] carefully, point out, have careful memory. runtime tracks normal memory allocations long close 'classes' correctly should ok. however, should make sure throwing exceptions not bypass normal rule clean up, such resetting error , backtracking flags , on.

(antlr-interest, circa 2009)

does have experience using antlr c target (advanced) c++? possible safely throw exceptions? code (if any) have write make safe?

i don't have antlr experience (sadly...), there no way make c code work exceptions around. refer more effective c++, item 9 : "use destructors prevent resource leaks"

the idea if exception thrown during cleanup, have no information on delete()ed not, , software will leak memory. if use auto_ptr/scroped_ptr, ou don't have worry this, since compiler deal itself.

but idiom c++-only, c not designed exceptions in mind.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -