[R] [FORGED] Re: Block comment?
S Ellison
S.Ellison at LGCGroup.com
Tue Sep 5 17:47:40 CEST 2017
> Do not the same considerations essentially apply to the well established
> /* .... */ convention used in C? Well maybe you simply *can't* get the "*/"
> string within a block of C code, but still ....
Yes, the same problem arises in C. And you _can_ get */ in valid code - as the closing part of a comment. Attempts to nest C block comments result in part of the outer block becoming uncommented and the outer block comment terminator becoming invalid syntax.
For example
main() {
/*
/* Hello world */ <- now the comment terminator
printf("hello world")
/* <- oops
}
Avoiding that trap is one reason that ANSI C block comments often use an extra ' *' at the beginning of each line - as in
/* **************
* An example ANSI C
* heading
* ************** */
which rather undermines the convenience of the whole thing.
So there's probably more than one reason // was added to C. That and better editors.
S Ellison
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list