cppannotations/annotations/yo/intro/eoln.yo
Frank B. Brokken 777b182edd Moved all files but 'excluded', 'sf', and 'sourcetar' to ./annotations
This allowed me to standardize the sourcetar and sf/* scripts: the base
    directory (containing ./git) is now empty, except for maintenance scripts,
    while the source files and build scripts of the annotations are stored in
    a subdirectory of their own.
2013-05-29 20:44:08 +02:00

24 lines
1.1 KiB
Text

According to the i(ANSI/ISO) definition, `i(end of line comment)' is
implemented in the syntax of bf(C++). This comment starts with ti(//) and ends
at the end-of-line marker. The standard bf(C) comment, delimited by tt(/*) and
tt(*/) can still be used in bf(C++):
verb(
int main()
{
// this is end-of-line comment
// one comment per line
/*
this is standard-C comment, covering
multiple lines
*/
}
)
Despite the example, it is advised em(not) to use bf(C) type comment
inside the body of bf(C++) functions. Sometimes existing code must temporarily
be suppressed, e.g., for testing purposes. In those cases it's very practical
to be able to use standard bf(C) comment. If such suppressed code itself
contains such comment, it would result in nested comment-lines, resulting in
compiler errors. Therefore, the i(rule of thumb) is not to use bf(C) type
comment inside the body of bf(C++) functions (alternatively, tt(#if 0) until
tt(#endif) pair of preprocessor directives could of course also be used).