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