Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

182 lines
8.4KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Disappointments (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="Disappointments (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="Disappointments (Using the GNU Compiler Collection (GCC))">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Trouble.html#Trouble" rel="up" title="Trouble">
  30. <link href="C_002b_002b-Misunderstandings.html#C_002b_002b-Misunderstandings" rel="next" title="C++ Misunderstandings">
  31. <link href="Standard-Libraries.html#Standard-Libraries" rel="prev" title="Standard Libraries">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Disappointments"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="C_002b_002b-Misunderstandings.html#C_002b_002b-Misunderstandings" accesskey="n" rel="next">C++ Misunderstandings</a>, Previous: <a href="Standard-Libraries.html#Standard-Libraries" accesskey="p" rel="prev">Standard Libraries</a>, Up: <a href="Trouble.html#Trouble" accesskey="u" rel="up">Trouble</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Disappointments-and-Misunderstandings"></a>
  68. <h3 class="section">14.6 Disappointments and Misunderstandings</h3>
  69. <p>These problems are perhaps regrettable, but we don&rsquo;t know any practical
  70. way around them.
  71. </p>
  72. <ul>
  73. <li> Certain local variables aren&rsquo;t recognized by debuggers when you compile
  74. with optimization.
  75. <p>This occurs because sometimes GCC optimizes the variable out of
  76. existence. There is no way to tell the debugger how to compute the
  77. value such a variable &ldquo;would have had&rdquo;, and it is not clear that would
  78. be desirable anyway. So GCC simply does not mention the eliminated
  79. variable when it writes debugging information.
  80. </p>
  81. <p>You have to expect a certain amount of disagreement between the
  82. executable and your source code, when you use optimization.
  83. </p>
  84. </li><li> <a name="index-conflicting-types"></a>
  85. <a name="index-scope-of-declaration"></a>
  86. Users often think it is a bug when GCC reports an error for code
  87. like this:
  88. <div class="smallexample">
  89. <pre class="smallexample">int foo (struct mumble *);
  90. struct mumble { &hellip; };
  91. int foo (struct mumble *x)
  92. { &hellip; }
  93. </pre></div>
  94. <p>This code really is erroneous, because the scope of <code>struct
  95. mumble</code> in the prototype is limited to the argument list containing it.
  96. It does not refer to the <code>struct mumble</code> defined with file scope
  97. immediately below&mdash;they are two unrelated types with similar names in
  98. different scopes.
  99. </p>
  100. <p>But in the definition of <code>foo</code>, the file-scope type is used
  101. because that is available to be inherited. Thus, the definition and
  102. the prototype do not match, and you get an error.
  103. </p>
  104. <p>This behavior may seem silly, but it&rsquo;s what the ISO standard specifies.
  105. It is easy enough for you to make your code work by moving the
  106. definition of <code>struct mumble</code> above the prototype. It&rsquo;s not worth
  107. being incompatible with ISO C just to avoid an error for the example
  108. shown above.
  109. </p>
  110. </li><li> Accesses to bit-fields even in volatile objects works by accessing larger
  111. objects, such as a byte or a word. You cannot rely on what size of
  112. object is accessed in order to read or write the bit-field; it may even
  113. vary for a given bit-field according to the precise usage.
  114. <p>If you care about controlling the amount of memory that is accessed, use
  115. volatile but do not use bit-fields.
  116. </p>
  117. </li><li> GCC comes with shell scripts to fix certain known problems in system
  118. header files. They install corrected copies of various header files in
  119. a special directory where only GCC will normally look for them. The
  120. scripts adapt to various systems by searching all the system header
  121. files for the problem cases that we know about.
  122. <p>If new system header files are installed, nothing automatically arranges
  123. to update the corrected header files. They can be updated using the
  124. <code>mkheaders</code> script installed in
  125. <samp><var>libexecdir</var>/gcc/<var>target</var>/<var>version</var>/install-tools/</samp>.
  126. </p>
  127. </li><li> <a name="index-floating-point-precision"></a>
  128. On 68000 and x86 systems, for instance, you can get paradoxical results
  129. if you test the precise values of floating point numbers. For example,
  130. you can find that a floating point value which is not a NaN is not equal
  131. to itself. This results from the fact that the floating point registers
  132. hold a few more bits of precision than fit in a <code>double</code> in memory.
  133. Compiled code moves values between memory and floating point registers
  134. at its convenience, and moving them into memory truncates them.
  135. <a name="index-ffloat_002dstore-1"></a>
  136. <p>You can partially avoid this problem by using the <samp>-ffloat-store</samp>
  137. option (see <a href="Optimize-Options.html#Optimize-Options">Optimize Options</a>).
  138. </p>
  139. </li><li> On AIX and other platforms without weak symbol support, templates
  140. need to be instantiated explicitly and symbols for static members
  141. of templates will not be generated.
  142. </li><li> On AIX, GCC scans object files and library archives for static
  143. constructors and destructors when linking an application before the
  144. linker prunes unreferenced symbols. This is necessary to prevent the
  145. AIX linker from mistakenly assuming that static constructor or
  146. destructor are unused and removing them before the scanning can occur.
  147. All static constructors and destructors found will be referenced even
  148. though the modules in which they occur may not be used by the program.
  149. This may lead to both increased executable size and unexpected symbol
  150. references.
  151. </li></ul>
  152. <hr>
  153. <div class="header">
  154. <p>
  155. Next: <a href="C_002b_002b-Misunderstandings.html#C_002b_002b-Misunderstandings" accesskey="n" rel="next">C++ Misunderstandings</a>, Previous: <a href="Standard-Libraries.html#Standard-Libraries" accesskey="p" rel="prev">Standard Libraries</a>, Up: <a href="Trouble.html#Trouble" accesskey="u" rel="up">Trouble</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  156. </div>
  157. </body>
  158. </html>