gcc手册

源代码在线查看: alternate-keywords.html

软件大小: 1194 K
上传用户: Erlin
关键词: gcc
下载地址: 免注册下载 普通下载 VIP

相关代码

				

				

				Using the GNU Compiler Collection (GCC)

				

				

				

				

								Copyright © 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,

				1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.

				

				   Permission is granted to copy, distribute and/or modify this document

				under the terms of the GNU Free Documentation License, Version 1.2 or

				any later version published by the Free Software Foundation; with the

				Invariant Sections being "GNU General Public License" and "Funding

				Free Software", the Front-Cover texts being (a) (see below), and with

				the Back-Cover Texts being (b) (see below).  A copy of the license is

				included in the section entitled "GNU Free Documentation License".

				

				   (a) The FSF's Front-Cover Text is:

				

				   A GNU Manual

				

				   (b) The FSF's Back-Cover Text is:

				

				   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.-->

				

				

				

				

				Node:Alternate Keywords,

				Next:Incomplete Enums,

				Previous:Explicit Reg Vars,

				Up:C Extensions

				

				

				

				Alternate Keywords

				

				   -ansi and the various -std options disable certain

				keywords.  This causes trouble when you want to use GNU C extensions, or

				a general-purpose header file that should be usable by all programs,

				including ISO C programs.  The keywords asm, typeof and

				inline are not available in programs compiled with

				-ansi or -std (although inline can be used in a

				program compiled with -std=c99).  The ISO C99 keyword

				restrict is only available when -std=gnu99 (which will

				eventually be the default) or -std=c99 (or the equivalent

				-std=iso9899:1999) is used.

				

				   The way to solve these problems is to put __ at the beginning and

				end of each problematical keyword.  For example, use __asm__

				instead of asm, and __inline__ instead of inline.

				

				   Other C compilers won't accept these alternative keywords; if you want to

				compile with another compiler, you can define the alternate keywords as

				macros to replace them with the customary keywords.  It looks like this:

				

				     #ifndef __GNUC__

				     #define __asm__ asm

				     #endif

				     

				

				   -pedantic and other options cause warnings for many GNU C extensions. 

				You can

				prevent such warnings within one expression by writing

				__extension__ before the expression.  __extension__ has no

				effect aside from this.

				

				   

				

							

相关资源