You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>Strings (Using as)</title>
  16. <meta name="description" content="Strings (Using as)">
  17. <meta name="keywords" content="Strings (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="Characters.html#Characters" rel="up" title="Characters">
  25. <link href="Chars.html#Chars" rel="next" title="Chars">
  26. <link href="Characters.html#Characters" rel="prev" title="Characters">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style: oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="Strings"></a>
  57. <div class="header">
  58. <p>
  59. Next: <a href="Chars.html#Chars" accesskey="n" rel="next">Chars</a>, Up: <a href="Characters.html#Characters" accesskey="u" rel="up">Characters</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  60. </div>
  61. <hr>
  62. <a name="Strings-1"></a>
  63. <h4 class="subsubsection">3.6.1.1 Strings</h4>
  64. <a name="index-string-constants"></a>
  65. <a name="index-constants_002c-string"></a>
  66. <p>A <em>string</em> is written between double-quotes. It may contain
  67. double-quotes or null characters. The way to get special characters
  68. into a string is to <em>escape</em> these characters: precede them with
  69. a backslash &lsquo;<samp>\</samp>&rsquo; character. For example &lsquo;<samp>\\</samp>&rsquo; represents
  70. one backslash: the first <code>\</code> is an escape which tells
  71. <code>as</code> to interpret the second character literally as a backslash
  72. (which prevents <code>as</code> from recognizing the second <code>\</code> as an
  73. escape character). The complete list of escapes follows.
  74. </p>
  75. <a name="index-escape-codes_002c-character"></a>
  76. <a name="index-character-escape-codes"></a>
  77. <dl compact="compact">
  78. <dd><a name="index--_005cb-_0028backspace-character_0029"></a>
  79. <a name="index-backspace-_0028_005cb_0029"></a>
  80. </dd>
  81. <dt><kbd>\b</kbd></dt>
  82. <dd><p>Mnemonic for backspace; for ASCII this is octal code 010.
  83. </p>
  84. <a name="index--_005cf-_0028formfeed-character_0029"></a>
  85. <a name="index-formfeed-_0028_005cf_0029"></a>
  86. </dd>
  87. <dt><kbd>backslash-f</kbd></dt>
  88. <dd><p>Mnemonic for FormFeed; for ASCII this is octal code 014.
  89. </p>
  90. <a name="index--_005cn-_0028newline-character_0029"></a>
  91. <a name="index-newline-_0028_005cn_0029"></a>
  92. </dd>
  93. <dt><kbd>\n</kbd></dt>
  94. <dd><p>Mnemonic for newline; for ASCII this is octal code 012.
  95. </p>
  96. <a name="index--_005cr-_0028carriage-return-character_0029"></a>
  97. <a name="index-carriage-return-_0028backslash_002dr_0029"></a>
  98. </dd>
  99. <dt><kbd>\r</kbd></dt>
  100. <dd><p>Mnemonic for carriage-Return; for ASCII this is octal code 015.
  101. </p>
  102. <a name="index--_005ct-_0028tab_0029"></a>
  103. <a name="index-tab-_0028_005ct_0029"></a>
  104. </dd>
  105. <dt><kbd>\t</kbd></dt>
  106. <dd><p>Mnemonic for horizontal Tab; for ASCII this is octal code 011.
  107. </p>
  108. <a name="index--_005cddd-_0028octal-character-code_0029"></a>
  109. <a name="index-octal-character-code-_0028_005cddd_0029"></a>
  110. </dd>
  111. <dt><kbd>\ <var>digit</var> <var>digit</var> <var>digit</var></kbd></dt>
  112. <dd><p>An octal character code. The numeric code is 3 octal digits.
  113. For compatibility with other Unix systems, 8 and 9 are accepted as digits:
  114. for example, <code>\008</code> has the value 010, and <code>\009</code> the value 011.
  115. </p>
  116. <a name="index--_005cxd_002e_002e_002e-_0028hex-character-code_0029"></a>
  117. <a name="index-hex-character-code-_0028_005cxd_002e_002e_002e_0029"></a>
  118. </dd>
  119. <dt><kbd>\<code>x</code> <var>hex-digits...</var></kbd></dt>
  120. <dd><p>A hex character code. All trailing hex digits are combined. Either upper or
  121. lower case <code>x</code> works.
  122. </p>
  123. <a name="index--_005c_005c-_0028_005c-character_0029"></a>
  124. <a name="index-backslash-_0028_005c_005c_0029"></a>
  125. </dd>
  126. <dt><kbd>\\</kbd></dt>
  127. <dd><p>Represents one &lsquo;<samp>\</samp>&rsquo; character.
  128. </p>
  129. <a name="index--_005c_0022-_0028doublequote-character_0029"></a>
  130. <a name="index-doublequote-_0028_005c_0022_0029"></a>
  131. </dd>
  132. <dt><kbd>\&quot;</kbd></dt>
  133. <dd><p>Represents one &lsquo;<samp>&quot;</samp>&rsquo; character. Needed in strings to represent
  134. this character, because an unescaped &lsquo;<samp>&quot;</samp>&rsquo; would end the string.
  135. </p>
  136. </dd>
  137. <dt><kbd>\ <var>anything-else</var></kbd></dt>
  138. <dd><p>Any other character when escaped by <kbd>\</kbd> gives a warning, but
  139. assembles as if the &lsquo;<samp>\</samp>&rsquo; was not present. The idea is that if
  140. you used an escape sequence you clearly didn&rsquo;t want the literal
  141. interpretation of the following character. However <code>as</code> has no
  142. other interpretation, so <code>as</code> knows it is giving you the wrong
  143. code and warns you of the fact.
  144. </p></dd>
  145. </dl>
  146. <p>Which characters are escapable, and what those escapes represent,
  147. varies widely among assemblers. The current set is what we think
  148. the BSD 4.2 assembler recognizes, and is a subset of what most C
  149. compilers recognize. If you are in doubt, do not use an escape
  150. sequence.
  151. </p>
  152. <hr>
  153. <div class="header">
  154. <p>
  155. Next: <a href="Chars.html#Chars" accesskey="n" rel="next">Chars</a>, Up: <a href="Characters.html#Characters" accesskey="u" rel="up">Characters</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  156. </div>
  157. </body>
  158. </html>