5
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
2 |
<html lang="en">
|
|
3 |
|
|
4 |
<head>
|
|
5 |
<meta http-equiv="Content-Language" content="en-us">
|
|
6 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
7 |
<title>Comments</title>
|
|
8 |
<link rel="stylesheet" type="text/css" href="../help.css">
|
|
9 |
</head>
|
|
10 |
|
|
11 |
<body>
|
|
12 |
|
|
13 |
<h1>Comments</h1>
|
|
14 |
<p>Comments are lines in a source file that have been marked to be ignored by the compiler.
|
|
15 |
Two styles of comments are supported by current C/C++ compilers:</p>
|
|
16 |
<ul>
|
|
17 |
<li><samp>/* text */</samp></li>
|
|
18 |
<li><samp>// text</samp></li>
|
|
19 |
</ul>
|
|
20 |
|
|
21 |
<h3>Comment</h3>
|
|
22 |
<p>You can quickly comment out one or more lines of code by inserting the leading
|
|
23 |
characters <samp>//</samp> at the beginning of the line. To do so, select the line
|
|
24 |
(or lines) of code you want to comment out and press <b>CTRL+/</b> (slash).</p>
|
|
25 |
|
|
26 |
<h3>Uncomment</h3>
|
|
27 |
<p>To uncomment select the line (or lines) of code, and press <b>CTRL+\</b>
|
|
28 |
(backslash).
|
|
29 |
|
|
30 |
<p><b>Tip:</b> The characters <samp>/* */</samp> on lines that are
|
|
31 |
already commented out, are not affected when you comment and uncomment code.</p>
|
|
32 |
|
|
33 |
<h3>Multiline comment</h3>
|
|
34 |
<p>You can use the Content Assist feature to insert a multi-line comment before a function.
|
|
35 |
Type <tt>com+Ctrl+Space</tt>, and the following code is entered at the cursor location:
|
|
36 |
<br><pre>
|
|
37 |
/*
|
|
38 |
* author userid
|
|
39 |
*
|
|
40 |
* To change this generated comment edit the template variable "comment":
|
|
41 |
* Window > Preferences > C/C++ > Editor > Templates.
|
|
42 |
*/
|
|
43 |
</pre>
|
|
44 |
|
|
45 |
To change the default comment click <b>Window > Preferences > C > Templates</b>. For more information see the
|
|
46 |
<a href="cdt_c_content_assist.htm">Content Assist</a> section.
|
|
47 |
|
|
48 |
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
|
|
49 |
<br>
|
|
50 |
<a href="cdt_c_content_assist.htm">Content Assist and code completion</a></p>
|
|
51 |
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
|
|
52 |
<br>
|
|
53 |
<a href="../tasks/cdt_t_cust_cpp_editor.htm">Customizing the C++ editor</a><br>
|
|
54 |
<a href="../tasks/cdt_t_comment_out.htm">Commenting out code</a></p>
|
|
55 |
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
|
56 |
<br>
|
|
57 |
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor preferences</a></p>
|
|
58 |
|
|
59 |
<p>
|
|
60 |
<img src="../images/rh03_04.gif" ALT="Red Hat Copyright Statement"><br>
|
|
61 |
<img src="../images/ng00_04a.gif" ALT=" IBM Copyright Statement" >
|
|
62 |
</p>
|
|
63 |
|
|
64 |
</body>
|
|
65 |
|
|
66 |
</html> |