Both kinds of C++ comments are allowed in Larch/C++: old C-style
comments and new C++-style comments.
However, if what looks like a comment starts with the at-sign (@)
character, then it is considered to be the start of an annotation by Larch/C++,
and not a comment.
(See section 4.3 Annotations, for details.)
Comments that are not annotations
do not affect the meaning of a Larch/C++ specification,
and should be included for the benefit of the human reader.
/* and the next */ is a comment.
This comment pair can appear
anywhere a white-space character is permitted and can span multiple
lines of specification.
Such comments cannot be nested.
//,
to the end of the line of the specification file in which the //
appears.
comment ::= C-style-comment | C++-style-comment C-style-comment ::=/*[ C-style-body ] C-style-end C-style-body ::= non-at-star [ non-star-slash ] ... | stars-non-slash [non-star-slash] ... non-star-slash ::= non-star | stars-non-slash stars-non-slash ::=*[*] ... non-slash non-at-star ::= any character except@or*non-star ::= any character except*non-slash ::= any character except/C-style-end ::= [*] ...*/C++-style-comment ::=//newline |//non-at-newline [ non-newline ] ... newline non-newline ::= any character except a newline non-at-newline ::= any character except@or newline
The character sequences
//, //@, /*, */, /*@, and @*/
have no special meaning within a //
comment and treated just like other characters. Similarly,
the character sequences //, //@, /*@,
and /* have no special meaning within a /*
comment.
The following are an examples of comments.
// @(#)$Id: comments.lh,v 1.1 1997/01/10 23:33:17 leavens Exp $ /* a C-style comment looks like this and may continue for several lines */ // A C++-style comment looks like this. // (The first line is one too.) // a /*weird*/ case of a C++-style (//) comment /* an equally strange // C-style (/*) comment **/ // the following is not an annotation: //@ ok? /* and /*@ neither is this part */
Go to the first, previous, next, last section, table of contents.