📄 disappointments.html
字号:
<html lang="en"><head><title>Using the GNU Compiler Collection (GCC)</title><meta http-equiv="Content-Type" content="text/html"><meta name="description" content="Using the GNU Compiler Collection (GCC)"><meta name="generator" content="makeinfo 4.6"><!--Copyright © 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. <p>Permission is granted to copy, distribute and/or modify this documentunder the terms of the GNU Free Documentation License, Version 1.2 orany later version published by the Free Software Foundation; with theInvariant Sections being "GNU General Public License" and "FundingFree Software", the Front-Cover texts being (a) (see below), and withthe Back-Cover Texts being (b) (see below). A copy of the license isincluded in the section entitled "GNU Free Documentation License". <p>(a) The FSF's Front-Cover Text is: <p>A GNU Manual <p>(b) The FSF's Back-Cover Text is: <p>You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.--><meta http-equiv="Content-Style-Type" content="text/css"><style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller }--></style></head><body><div class="node"><p>Node: <a name="Disappointments">Disappointments</a>,Next: <a rel="next" accesskey="n" href="C---Misunderstandings.html#C++%20Misunderstandings">C++ Misunderstandings</a>,Previous: <a rel="previous" accesskey="p" href="Standard-Libraries.html#Standard%20Libraries">Standard Libraries</a>,Up: <a rel="up" accesskey="u" href="Trouble.html#Trouble">Trouble</a><hr><br></div><h3 class="section">Disappointments and Misunderstandings</h3><p>These problems are perhaps regrettable, but we don't know any practicalway around them. <ul><li>Certain local variables aren't recognized by debuggers when you compilewith optimization. <p>This occurs because sometimes GCC optimizes the variable out ofexistence. There is no way to tell the debugger how to compute thevalue such a variable "would have had", and it is not clear that wouldbe desirable anyway. So GCC simply does not mention the eliminatedvariable when it writes debugging information. <p>You have to expect a certain amount of disagreement between theexecutable and your source code, when you use optimization. </p><li>Users often think it is a bug when GCC reports an error for codelike this: <pre class="smallexample"> int foo (struct mumble *); struct mumble { ... }; int foo (struct mumble *x) { ... } </pre> <p>This code really is erroneous, because the scope of <code>structmumble</code> in the prototype is limited to the argument list containing it. It does not refer to the <code>struct mumble</code> defined with file scopeimmediately below--they are two unrelated types with similar names indifferent scopes. <p>But in the definition of <code>foo</code>, the file-scope type is usedbecause that is available to be inherited. Thus, the definition andthe prototype do not match, and you get an error. <p>This behavior may seem silly, but it's what the ISO standard specifies. It is easy enough for you to make your code work by moving thedefinition of <code>struct mumble</code> above the prototype. It's not worthbeing incompatible with ISO C just to avoid an error for the exampleshown above. </p><li>Accesses to bit-fields even in volatile objects works by accessing largerobjects, such as a byte or a word. You cannot rely on what size ofobject is accessed in order to read or write the bit-field; it may evenvary for a given bit-field according to the precise usage. <p>If you care about controlling the amount of memory that is accessed, usevolatile but do not use bit-fields. </p><li>GCC comes with shell scripts to fix certain known problems in systemheader files. They install corrected copies of various header files ina special directory where only GCC will normally look for them. Thescripts adapt to various systems by searching all the system headerfiles for the problem cases that we know about. <p>If new system header files are installed, nothing automatically arrangesto update the corrected header files. You will have to reinstall GCCto fix the new header files. More specifically, go to the builddirectory and delete the files <code>stmp-fixinc</code> and<code>stmp-headers</code>, and the subdirectory <code>include</code>; then do<code>make install</code> again. </p><li>On 68000 and x86 systems, for instance, you can get paradoxical resultsif you test the precise values of floating point numbers. For example,you can find that a floating point value which is not a NaN is not equalto itself. This results from the fact that the floating point registershold a few more bits of precision than fit in a <code>double</code> in memory. Compiled code moves values between memory and floating point registersat its convenience, and moving them into memory truncates them. <p>You can partially avoid this problem by using the <code>-ffloat-store</code>option (see <a href="Optimize-Options.html#Optimize%20Options">Optimize Options</a>). </p><li>On AIX and other platforms without weak symbol support, templatesneed to be instantiated explicitly and symbols for static membersof templates will not be generated. <li>On AIX, GCC scans object files and library archives for staticconstructors and destructors when linking an application before thelinker prunes unreferenced symbols. This is necessary to prevent theAIX linker from mistakenly assuming that static constructor ordestructor are unused and removing them before the scanning can occur. All static constructors and destructors found will be referenced eventhough the modules in which they occur may not be used by the program. This may lead to both increased executable size and unexpected symbolreferences. </ul> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -