Standardization questions --

decot decot at hpdsa.UUCP
Sat Oct 27 22:24:00 AEST 1984


A solution to this problem is suggested by the comment style of Ada, which
is that portions of lines beginning with '--' are ignored.  Since
this would be rather unacceptable in C, and we want the preprocessor to
handle it, the rule that leaps to mind is:

    Lines or portions of lines beginning with '##' are ignored, except
    within single or double quotes, or within the /* other kind of */ comment.
    This rule applies even if the remainder of the line contains '/*'.

Voila!  No problems with nesting, and it's always immediately obvious whether
a line is commented out, if you use consistently use only ## in new programs.
This also has the advantage that all existing correct sources would remain
correct, which is not true under comment nesting.

Dave Decot  hpda!decot



More information about the Comp.lang.c mailing list