extend.texi (219639) | extend.texi (220755) |
---|---|
1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2@c 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 3 4@c This is part of the GCC manual. 5@c For copying conditions, see the file gcc.texi. 6 7@node C Extensions 8@chapter Extensions to the C Language Family 9@cindex extensions, C language 10@cindex C language extensions 11 12@opindex pedantic 13GNU C provides several language features not found in ISO standard C@. 14(The @option{-pedantic} option directs GCC to print a warning message if 15any of these features is used.) To test for the availability of these 16features in conditional compilation, check for a predefined macro 17@code{__GNUC__}, which is always defined under GCC@. 18 | 1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2@c 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 3 4@c This is part of the GCC manual. 5@c For copying conditions, see the file gcc.texi. 6 7@node C Extensions 8@chapter Extensions to the C Language Family 9@cindex extensions, C language 10@cindex C language extensions 11 12@opindex pedantic 13GNU C provides several language features not found in ISO standard C@. 14(The @option{-pedantic} option directs GCC to print a warning message if 15any of these features is used.) To test for the availability of these 16features in conditional compilation, check for a predefined macro 17@code{__GNUC__}, which is always defined under GCC@. 18 |
19These extensions are available in C and Objective-C@. Most of them are 20also available in C++. @xref{C++ Extensions,,Extensions to the 21C++ Language}, for extensions that apply @emph{only} to C++. | 19These extensions are available in C. Most of them are also available 20in C++. @xref{C++ Extensions,,Extensions to the C++ Language}, for 21extensions that apply @emph{only} to C++. |
22 23Some features that are in ISO C99 but not C89 or C++ are also, as 24extensions, accepted by GCC in C89 mode and in C++. 25 26@menu 27* Statement Exprs:: Putting statements and declarations inside expressions. 28* Local Labels:: Labels local to a block. 29* Labels as Values:: Getting pointers to labels, and computed gotos. --- 1681 unchanged lines hidden (view full) --- 1711The @code{constructor} attribute causes the function to be called 1712automatically before execution enters @code{main ()}. Similarly, the 1713@code{destructor} attribute causes the function to be called 1714automatically after @code{main ()} has completed or @code{exit ()} has 1715been called. Functions with these attributes are useful for 1716initializing data that will be used implicitly during the execution of 1717the program. 1718 | 22 23Some features that are in ISO C99 but not C89 or C++ are also, as 24extensions, accepted by GCC in C89 mode and in C++. 25 26@menu 27* Statement Exprs:: Putting statements and declarations inside expressions. 28* Local Labels:: Labels local to a block. 29* Labels as Values:: Getting pointers to labels, and computed gotos. --- 1681 unchanged lines hidden (view full) --- 1711The @code{constructor} attribute causes the function to be called 1712automatically before execution enters @code{main ()}. Similarly, the 1713@code{destructor} attribute causes the function to be called 1714automatically after @code{main ()} has completed or @code{exit ()} has 1715been called. Functions with these attributes are useful for 1716initializing data that will be used implicitly during the execution of 1717the program. 1718 |
1719These attributes are not currently implemented for Objective-C@. 1720 | |
1721@item deprecated 1722@cindex @code{deprecated} attribute. 1723The @code{deprecated} attribute results in a warning if the function 1724is used anywhere in the source file. This is useful when identifying 1725functions that are expected to be removed in a future version of a 1726program. The warning also includes the location of the declaration 1727of the deprecated function, to enable users to easily find further 1728information about why the function is deprecated, or what they should --- 871 unchanged lines hidden (view full) --- 2600Preprocessing Directives, cpp, The GNU C Preprocessor}. 2601 2602@node Attribute Syntax 2603@section Attribute Syntax 2604@cindex attribute syntax 2605 2606This section describes the syntax with which @code{__attribute__} may be 2607used, and the constructs to which attribute specifiers bind, for the C | 1719@item deprecated 1720@cindex @code{deprecated} attribute. 1721The @code{deprecated} attribute results in a warning if the function 1722is used anywhere in the source file. This is useful when identifying 1723functions that are expected to be removed in a future version of a 1724program. The warning also includes the location of the declaration 1725of the deprecated function, to enable users to easily find further 1726information about why the function is deprecated, or what they should --- 871 unchanged lines hidden (view full) --- 2598Preprocessing Directives, cpp, The GNU C Preprocessor}. 2599 2600@node Attribute Syntax 2601@section Attribute Syntax 2602@cindex attribute syntax 2603 2604This section describes the syntax with which @code{__attribute__} may be 2605used, and the constructs to which attribute specifiers bind, for the C |
2608language. Some details may vary for C++ and Objective-C@. Because of 2609infelicities in the grammar for attributes, some forms described here 2610may not be successfully parsed in all cases. | 2606language. Some details may vary for C++. Because of infelicities in 2607the grammar for attributes, some forms described here may not be 2608successfully parsed in all cases. |
2611 2612There are some problems with the semantics of attributes in C++. For 2613example, there are no manglings for attributes, although they may affect 2614code generation, so problems may arise when attributed types are used in 2615conjunction with templates or overloading. Similarly, @code{typeid} 2616does not distinguish between types with different attributes. Support 2617for attributes in C++ may be restricted in future to attributes on 2618declarations only, but not on nested declarators. --- 7272 unchanged lines hidden (view full) --- 9891 9892@table @code 9893@item align @var{alignment} (@var{variable} [, @var{variable}]...) 9894@cindex pragma, align 9895 9896Increase the minimum alignment of each @var{variable} to @var{alignment}. 9897This is the same as GCC's @code{aligned} attribute @pxref{Variable 9898Attributes}). Macro expansion occurs on the arguments to this pragma | 2609 2610There are some problems with the semantics of attributes in C++. For 2611example, there are no manglings for attributes, although they may affect 2612code generation, so problems may arise when attributed types are used in 2613conjunction with templates or overloading. Similarly, @code{typeid} 2614does not distinguish between types with different attributes. Support 2615for attributes in C++ may be restricted in future to attributes on 2616declarations only, but not on nested declarators. --- 7272 unchanged lines hidden (view full) --- 9889 9890@table @code 9891@item align @var{alignment} (@var{variable} [, @var{variable}]...) 9892@cindex pragma, align 9893 9894Increase the minimum alignment of each @var{variable} to @var{alignment}. 9895This is the same as GCC's @code{aligned} attribute @pxref{Variable 9896Attributes}). Macro expansion occurs on the arguments to this pragma |
9899when compiling C and Objective-C. It does not currently occur when 9900compiling C++, but this is a bug which may be fixed in a future 9901release. | 9897when compiling C. It does not currently occur when compiling C++, but 9898this is a bug which may be fixed in a future release. |
9902 9903@item fini (@var{function} [, @var{function}]...) 9904@cindex pragma, fini 9905 9906This pragma causes each listed @var{function} to be called after 9907main, or during shared module unloading, by adding a call to the 9908@code{.fini} section. 9909 --- 1214 unchanged lines hidden --- | 9899 9900@item fini (@var{function} [, @var{function}]...) 9901@cindex pragma, fini 9902 9903This pragma causes each listed @var{function} to be called after 9904main, or during shared module unloading, by adding a call to the 9905@code{.fini} section. 9906 --- 1214 unchanged lines hidden --- |