You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/c/comment.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,21 +14,21 @@ Comments serve as a sort of in-code documentation. When inserted into a program,
14
14
1) Often known as "C-style" or "multi-line" comments.
15
15
2) Often known as "C++-style" or "single-line" comments.
16
16
17
-
All comments are removed from the program at <DocLinksrc="/c/language/translation_phases">translation phase 3</DocLink> by replacing each comment with a single whitespace character.
17
+
All comments are removed from the program at <DocLinkdest="/c/language/translation_phases">translation phase 3</DocLink> by replacing each comment with a single whitespace character.
18
18
19
19
### C-style
20
20
21
21
C-style comments are usually used to comment large blocks of text or small fragments of code; however, they can be used to comment single lines. To insert text as a C-style comment, simply surround the text with `/*` and `*/`. C-style comments tell the compiler to ignore all content between `/*` and `*/`. Although it is not part of the C standard, `/**` and `**/` are often used to indicate documentation blocks; this is legal because the second asterisk is simply treated as part of the comment.
22
22
23
-
Except within a <DocLinksrc="/c/language/character_constant">character constant</DocLink>, a <DocLinksrc="/c/language/string_literal">string literal</DocLink>, or a comment, the characters `/*` introduce a comment. The contents of such a comment are examined only to identify multibyte characters and to find the characters `*/` that terminate the comment. C-style comments cannot be nested.
23
+
Except within a <DocLinkdest="/c/language/character_constant">character constant</DocLink>, a <DocLinkdest="/c/language/string_literal">string literal</DocLink>, or a comment, the characters `/*` introduce a comment. The contents of such a comment are examined only to identify multibyte characters and to find the characters `*/` that terminate the comment. C-style comments cannot be nested.
24
24
25
25
<RevisionBlocksince="C99">
26
26
27
27
### C++-style
28
28
29
29
C++-style comments are usually used to comment single lines of text or code; however, they can be placed together to form multi-line comments. To insert text as a C++-style comment, simply precede the text with `//` and follow the text with the new line character. C++-style comments tell the compiler to ignore all content between `//` and a new line.
30
30
31
-
Except within a <DocLinksrc="/c/language/character_constant">character constant</DocLink>, a <DocLinksrc="/c/language/string_literal">string literal</DocLink>, or a comment, the characters `//` introduce a comment that includes all multibyte characters up to, but not including, the next new-line character. The contents of such a comment are examined only to identify multibyte characters and to find the new-line character that terminates the comment. C++-style comments can be nested:
31
+
Except within a <DocLinkdest="/c/language/character_constant">character constant</DocLink>, a <DocLinkdest="/c/language/string_literal">string literal</DocLink>, or a comment, the characters `//` introduce a comment that includes all multibyte characters up to, but not including, the next new-line character. The contents of such a comment are examined only to identify multibyte characters and to find the new-line character that terminates the comment. C++-style comments can be nested:
32
32
33
33
```c
34
34
// y = f(x); // invoke algorithm
@@ -53,7 +53,7 @@ A C++-style comment may appear within a C-style comment; this is a mechanism for
53
53
54
54
### Notes
55
55
56
-
Because comments <DocLinksrc="/c/language/translation_phases">are removed</DocLink> before the preprocessor stage, a macro cannot be used to form a comment and an unterminated C-style comment doesn't spill over from an #include'd file.
56
+
Because comments <DocLinkdest="/c/language/translation_phases">are removed</DocLink> before the preprocessor stage, a macro cannot be used to form a comment and an unterminated C-style comment doesn't spill over from an #include'd file.
57
57
58
58
```c
59
59
/* An attempt to use a macro to form a comment. */
@@ -151,6 +151,6 @@ Hello, again
151
151
152
152
<DescList>
153
153
<Desc>
154
-
<DocLinkslot="item"src="/cpp/comments">C++ documentation</DocLink> for <span>Comments</span>
154
+
<DocLinkslot="item"dest="/cpp/comments">C++ documentation</DocLink> for <span>Comments</span>
0 commit comments