Richard Thrippleton wrote: > Now that the C target can be built by a C++ compiler, I've been trying > to throw C++-style exceptions (as opposed to the exception system > internal to ANTLR's C target) from within embedded actions. > > My grammars build successfully, and the exceptions seem to behave as I'd > expect at runtime. However, I suspect I'm leaving myself open to > undefined behaviour; are C++ exceptions within the C output actually > supported, or is it merely co-incidence that nothing horrendous has > happened? > > My main fear would be memory leaks, but I'm not 100% sure if this is > happening or not. > You can probably use them carefully, but as you point out, you have to be careful with memory. The runtime tracks all its normal memory allocations so as long as you close the 'classes' correctly you should generally be OK. However, you should make sure that throwing exceptions does not bypass the normal rule clean up, such as resetting error and backtracking flags and so on,
Jim List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
