Ambiguous comment syntax

Daniel Keep daniel.keep.lists at gmail.com
Sat Aug 8 22:40:17 PDT 2009



Oliver Hoog wrote:
> Since one of D's goals is dropping the bad things from C/C++, I wonder
> why the ambiguous syntax for multi-line comments is still allowed:
> ---
>     auto p = new int;
>     *p = 10;
>     auto j = 100/*p;    <- error
> ---
> There is already the unambiguous /+...+/ syntax, so why not drop the
> /*...*/ syntax? Compatibility? Convenience? I think D should be more
> pragmatic.
> What do you think?

It's not ambiguous.  Tokens are matched with maximal munch meaning that
/* is ALWAYS the opening of a multi-line comment.



More information about the Digitalmars-d mailing list