⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 编 译.htm

📁 ARM开发环境ADS1.2使用指南,网页格式
💻 HTM
📖 第 1 页 / 共 4 页
字号:
            compiled. Programmers have plenty of typing ahead of them, so they 
            sometimes use shortcuts, known as macros. These macros allow you to 
            type things like APPNAME when you really mean "Metrowerks 
            CodeWarrior" and save keystrokes as you type your source code. 
            Preprocessing converts the macro text you've typed into the code it 
            represents. The preprocessor also substitutes defined symbols (such 
            as #define THREE 3) in the source code. To get a better feel for 
            what the preprocessor accomplishes, you can examine a listing of its 
            output. To do this, pick a source file in the Project window and 
            select Preprocess from the Project menu. The output file that 
            appears shows the preprocessed source code as the compiler will 
            actually see it.</P>
            <P><B><FONT size=+1>Customizing the Way CodeWarrior 
            Compiles</FONT></B></P>
            <P>In Lesson 2, I showed you a few of the dialog boxes that control 
            the way CodeWarrior compiles code. Let's take a closer look at some 
            standard C and C++ compiler settings. Please follow along in your 
            copy of CodeWarrior.</P>
            <TABLE cellSpacing=0 cellPadding=0 border=0>
              <TBODY>
              <TR>
                <TD><IMG height=422 
                  alt="Figure 3-1: The C/C++ Language Settings control the way CodeWarrior deals with C and C++ code when compiling." 
                  src="编       译.files/icwwL3_fig1.gif" width=626 align=left> 
              </TD></TR>
              <TR>
                <TD align=middle><FONT size=1><I>Figure 3-1: The C/C++ 
                  Language Settings control the way CodeWarrior deals with C and 
                  C++ code when compiling.</I></FONT> </TD></TR></TBODY></TABLE>
            <P>Open the Settings window by selecting Project Hello World x86 
            Settings from the Edit menu. Now, click the C/C++ Language label 
            under the Language Settings category (Figure 3-1). You will see that 
            there are numerous options in the C/C++ Language Settings Dialog 
            Box. Let's take a look at some of these items one by one and see how 
            they affect the compilation process.
            <UL>
              <LI><B>Activate C++ Compiler:</B> This option allows you to 
              compile all .c source files as if they were .cpp files. This can 
              be helpful if you want to use some of the features of the C++ 
              programming language in your C source code. 
              <LI><B>ARM Conformance:</B> The compiler expects your code to 
              follow the ANSI C++ standard. You can direct the compiler to 
              instead follow the standard specified in the Annotated C++ 
              Reference Manual (ARM) by enabling this feature. 
              <LI><B>Enable C++ Exceptions:</B> Enabling this feature allows you 
              to use try/catch/throw blocks in your C++ code. These methods help 
              with writing error handlers. 
              <LI><B>Enable RTTI: </B>RTTI stands for Run Time Type Information. 
              This allows the compiler to figure out the type of a C++ object at 
              run-time. This is an advanced feature of C++ that can be helpful 
              in various situations. See your C++ manual for more information on 
              RTTI. 
              <LI><B>Inline Depth/Auto-Inline/Deferred Inlining:</B> These 
              options refer to the inlining of functions in your source code. 
              That is, rather than generate the function call, the compiler 
              inserts the function's code directly into the program body. In 
              certain situations, this can improve code performance. This is an 
              advanced compiler feature. 
              <LI><B>Pool Strings:</B> Normally, the compiler will store all of 
              your string objects in their own data space within your compiled 
              code. If you would like all strings to be stored in just one data 
              space, you can enable this feature. If you have a large number of 
              strings in your source code (such as the APPNAME macro we 
              discussed earlier), you should enable this feature to save memory. 
              Be aware that although this checkbox is present in the Windows 
              version of CodeWarrior, the feature only works for Mac OS PowerPC 
              program code. 
              <LI><B>Don't Reuse Strings:</B> If you have multiple strings that 
              are the same throughout your program, the compiler will store them 
              all in the same data space -- that is, it will reuse them. 
              However, there are times when you may alter the string literal in 
              place, in which case other strings that share its data space would 
              also be altered. If you do not want this to happen, enable this 
              feature, and all strings, even if they are identical, will be 
              stored in separate data spaces. 
              <LI><B>Require Function Prototypes:</B> It's a good idea to keep 
              this feature enabled. Function prototypes allow you to more easily 
              find errors in your source code by assisting the compiler in 
              verifying data types that you pass to your functions. A function 
              prototype is also known as a forward declaration. That is, you 
              define (declare) the function before (forward) you use it. If this 
              feature is so good, when might you turn it off? Typically, when 
              you're working with old C programs that never made forward 
              declarations of their function calls. You'd disable this option 
              only to check the integrity of the program code. However, you'd 
              want to write function prototypes for the program and reactivate 
              this feature quickly, because it solves so many coding problems. 
              <LI><B>Enable bool Support:</B> To use the C++ bool, true and 
              false keywords, enable this feature. 
              <LI><B>Enable wchar_t Support:</B> To use the C++ wchar_t built-in 
              type for characters rather than char, enable this feature. 
              <LI><B>ANSI Strict/ANSI Keywords Only:</B> By default, the 
              compiler allows you to use Metrowerks extensions and additional 
              keywords in the C and C++ languages. If you would like an error to 
              be generated when you try to do this, enable the ANSI Strict 
              and/or ANSI Keywords Only feature. This will ensure that you only 
              compile 100 percent ANSI-compatible code. 
              <LI><B>Expand Trigraphs:</B> By default, trigraphs are ignored. To 
              expand them, you can enable this feature. Trigraphs have to do 
              with the way character constants are represented in your source 
              code. For example, '????' is a trigraph. 
              <LI><B>Multi-Byte Aware</B> : If you are programming in a language 
              that requires the use of multi-byte characters (like Kanji or 
              Unicode), you will want to enable this feature. This enables the 
              compiler to properly handle multi-byte characters in the source 
              code. 
              <LI><B>Direct to SOM:</B> This is a Macintosh-only feature that 
              allows you to create SOM code directly in CodeWarrior. SOM is a 
              type of code used in the now defunct OpenDoc environment from 
              Apple Computer. 
              <LI><B>Map Newlines to CR:</B> This feature allows you to swap 
              '\n' and '\r' (the values for line feed and carriage return, which 
              mark the end of a source code line). This is feature is only 
              useful for Mac OS programs. 
              <LI><B>Relaxed Pointer Type Rules:</B> Enabling this feature will 
              treat char *, unsigned char *, void * and Ptr as the same type. 
              This can be helpful when you inherit code from another source in 
              which the programmer did not properly manage pointer types, and/or 
              the developer used an old compiler that did not handle these types 
              properly. 
              <LI><B>Enums Always Ints:</B> Normally, the compiler will make an 
              enumerated type the size of the closest type. If you would like 
              types to always be the size of an int, you can enable this 
              feature. An enumerated type is something like this: enum {itemone, 
              itemtwo = 7, itemthree}. In this case, itemone would be equal to 
              0, itemtwo would be equal to 7, and itemthree would be equal to 8. 

              <LI><B>Use Unsigned Chars:</B> Enabling this feature will cause 
              all char data types to be treated as if they were unsigned char. 
              <LI><B>EC++ Compatibility Mode:</B> Enable this feature to compile 
              embedded C++ (EC++) code. Note that certain C++ goodies such as 
              templates, exceptions, and other advanced C++ features aren't 
              available in EC++. See your C++ manual for information. 
              <LI><B>Enable Objective C:</B> To enable Objective C (made famous 
              in the NeXT computer operating system) you can check this 
              checkbox. This is another Mac OS-only language feature. 
              <LI><B>Prefix File:</B> To include a header or precompiled header 
              in every source file, type the name here. This can be useful if 
              you have specific definitions that you want all source files to 
              have access to, but do not want to type the #include line in the 
              source files themselves. </LI></UL></FONT>
            <P><FONT face="Arial, Helvetica, sans-serif" size=2><B>Note:</B> 
            Many of these features are identical on both the Mac OS and Windows 
            CodeWarrior compilers. As pointed out in the descriptions of the 
            compiler settings above, there are some differences between the two. 
            However, C and C++ are platform-independent languages, so most of 
            these concepts apply on any platform.</FONT><BR><!-- end main lesson content --><BR></P></TD></TR></TBODY></TABLE></CENTER></DIV></TD></TR>
  <TR>
    <TD width="100%">
      <P align=right><NOBR><INPUT onclick=self.close(); type=button value="关闭此窗口 "></NOBR> 
      </P></TD></TR>
  <TR>
    <TD width="100%">
      <HR width="96%" color=#000000 noShade SIZE=1>
    </TD></TR>
  <TR>
    <TD class=font width="100%">
      <P align=center>Copyright(C) 2000 <A 
      href="http://www.tsinghua-solution.com.cn/" 
      target=_blank>北京清华北方思路信息技术有限公司</A> 版权所有<BR>未经许可,不得转载、摘登、结集出版<BR>联系电话:(8610)-62978899-146</P></TD></TR></TBODY></TABLE></CENTER></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -