[antlr-interest] "finally" blocks

Christopher Schultz christopher.d.schultz at comcast.net
Mon Jan 17 14:54:01 PST 2005


Paul,

>>>	In using ANTLR with Java, it would be nice to be able to specify
>>>	"finally" blocks, e.g.:
> 
>>Good idea Paul.  Is there a decent equiv in all potential targets?
> 
> 	I don't know about all targets, but C++ doesn't need "finally"
> 	because C++ has destructors.  The only reason Java needs
> 	"finally" is because it doesn't have destructors.

I think that's a flawed comparison. Destructors are in C++ what 
finalizers are in Java. A "finally" block is different. I agree with 
Brian Ewbank's comments that Java-style "finally" behavior can be 
achieved in C++. About all you need is "goto" with an in-scope return 
value in the function.

-chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20050117/c44d67d3/signature.bin


More information about the antlr-interest mailing list