📄 protoize-caveats.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="Protoize%20Caveats">Protoize Caveats</a>,Next: <a rel="next" accesskey="n" href="Non-bugs.html#Non-bugs">Non-bugs</a>,Previous: <a rel="previous" accesskey="p" href="C---Misunderstandings.html#C++%20Misunderstandings">C++ Misunderstandings</a>,Up: <a rel="up" accesskey="u" href="Trouble.html#Trouble">Trouble</a><hr><br></div><h3 class="section">Caveats of using <code>protoize</code></h3><p>The conversion programs <code>protoize</code> and <code>unprotoize</code> cansometimes change a source file in a way that won't work unless yourearrange it. <ul><li><code>protoize</code> can insert references to a type name or type tag beforethe definition, or in a file where they are not defined. <p>If this happens, compiler error messages should show you where the newreferences are, so fixing the file by hand is straightforward. </p><li>There are some C constructs which <code>protoize</code> cannot figure out. For example, it can't determine argument types for declaring apointer-to-function variable; this you must do by hand. <code>protoize</code>inserts a comment containing <code>???</code> each time it finds such avariable; so you can find all such variables by searching for thisstring. ISO C does not require declaring the argument types ofpointer-to-function types. <li>Using <code>unprotoize</code> can easily introduce bugs. If the programrelied on prototypes to bring about conversion of arguments, theseconversions will not take place in the program without prototypes. One case in which you can be sure <code>unprotoize</code> is safe is whenyou are removing prototypes that were made with <code>protoize</code>; ifthe program worked before without any prototypes, it will work againwithout them. <p>You can find all the places where this problem might occur by compilingthe program with the <code>-Wconversion</code> option. It prints a warningwhenever an argument is converted. </p><li>Both conversion programs can be confused if there are macro calls in andaround the text to be converted. In other words, the standard syntaxfor a declaration or definition must not result from expanding a macro. This problem is inherent in the design of C and cannot be fixed. Ifonly a few functions have confusing macro calls, you can easily convertthem manually. <li><code>protoize</code> cannot get the argument types for a function whosedefinition was not actually compiled due to preprocessing conditionals. When this happens, <code>protoize</code> changes nothing in regard to sucha function. <code>protoize</code> tries to detect such instances and warnabout them. <p>You can generally work around this problem by using <code>protoize</code> stepby step, each time specifying a different set of <code>-D</code> options forcompilation, until all of the functions have been converted. There isno automatic way to verify that you have got them all, however. </p><li>Confusion may result if there is an occasion to convert a functiondeclaration or definition in a region of source code where there is morethan one formal parameter list present. Thus, attempts to convert codecontaining multiple (conditionally compiled) versions of a singlefunction header (in the same vicinity) may not produce the desired (orexpected) results. <p>If you plan on converting source files which contain such code, it isrecommended that you first make sure that each conditionally compiledregion of source code which contains an alternative function header alsocontains at least one additional follower token (past the final rightparenthesis of the function header). This should circumvent theproblem. </p><li><code>unprotoize</code> can become confused when trying to convert a functiondefinition or declaration which contains a declaration for apointer-to-function formal argument which has the same name as thefunction being defined or declared. We recommend you avoid such choicesof formal parameter names. <li>You might also want to correct some of the indentation by hand and breaklong lines. (The conversion programs don't write lines longer thaneighty characters in any case.) </ul> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -