[antlr-interest] Re: nested comments

Paul Johnson gt54-antlr at cyconix.com
Wed Jul 6 04:40:58 PDT 2005


David Wigg wrote:
> With reference to recent messages about nested C comments, I am not 
> aware that any comments can be nested, eg. something like,
> 
> /* comment
> source code /* nested comment */
> source code
> */ .
> 
> In my (bitter) experience the first closing (*/) after an opening (/*) 
> closes the comment.
> 
> Perhaps I misunderstood the meaning of nested here?
> 
> If this is legal please could someone quote any reference supporting it.

It's definitely illegal - see footnote 69 on p66 of the spec. However, I 
think it's occasionally supported - Borland does (used to?), but I don't 
think gcc does.

Paul



More information about the antlr-interest mailing list