?? library_1.html
字號(hào):
feature test macro definition (see section <A HREF="library_1.html#SEC12" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_1.html#SEC12">Feature Test Macros</A>).
<P>
For more information about the use of header files and <SAMP>`#include'</SAMP>
directives, see section 'Header Files' in <CITE>The GNU C Preprocessor Manual</CITE>.<P>
The GNU C library provides several header files, each of which contains
the type and macro definitions and variable and function declarations
for a group of related facilities. This means that your programs may
need to include several header files, depending on exactly which
facilities you are using.
<P>
Some library header files include other library header files
automatically. However, as a matter of programming style, you should
not rely on this; it is better to explicitly include all the header
files required for the library facilities you are using. The GNU C
library header files have been written in such a way that it doesn't
matter if a header file is accidentally included more than once;
including a header file a second time has no effect. Likewise, if your
program needs to include multiple header files, the order in which they
are included doesn't matter.
<P>
<STRONG>Compatibility Note:</STRONG> Inclusion of standard header files in any
order and any number of times works in any ANSI C implementation.
However, this has traditionally not been the case in many older C
implementations.
<P>
Strictly speaking, you don't <EM>have to</EM> include a header file to use
a function it declares; you could declare the function explicitly
yourself, according to the specifications in this manual. But it is
usually better to include the header file because it may define types
and macros that are not otherwise available and because it may define
more efficient macro replacements for some functions. It is also a sure
way to have the correct declaration.
<P>
<A NAME="IDX21"></A>
<A NAME="IDX22"></A>
<A NAME="IDX23"></A>
<H3><A NAME="SEC10" HREF="library_toc.html#SEC10" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC10">Macro Definitions of Functions</A></H3>
<P>
If we describe something as a function in this manual, it may have a
macro definition as well. This normally has no effect on how your
program runs--the macro definition does the same thing as the function
would. In particular, macro equivalents for library functions evaluate
arguments exactly once, in the same way that a function call would. The
main reason for these macro definitions is that sometimes they can
produce an inline expansion that is considerably faster than an actual
function call.
<P>
Taking the address of a library function works even if it is also
defined as a macro. This is because, in this context, the name of the
function isn't followed by the left parenthesis that is syntactically
necessary to recognize the a macro call.
<P>
You might occasionally want to avoid using the a macro definition of a
function--perhaps to make your program easier to debug. There are
two ways you can do this:
<P>
<UL>
<LI>
You can avoid a macro definition in a specific use by enclosing the name
of the function in parentheses. This works because the name of the
function doesn't appear in a syntactic context where it is recognizable
as a macro call.
<P>
<LI>
You can suppress any macro definition for a whole source file by using
the <SAMP>`#undef'</SAMP> preprocessor directive, unless otherwise stated
explicitly in the description of that facility.
</UL>
<P>
For example, suppose the header file <TT>`stdlib.h'</TT> declares a function
named <CODE>abs</CODE> with
<P>
<PRE>
extern int abs (int);
</PRE>
<P>
and also provides a macro definition for <CODE>abs</CODE>. Then, in:
<P>
<PRE>
#include <stdlib.h>
int f (int *i) { return (abs (++*i)); }
</PRE>
<P>
the reference to <CODE>abs</CODE> might refer to either a macro or a function.
On the other hand, in each of the following examples the reference is
to a function and not a macro.
<P>
<PRE>
#include <stdlib.h>
int g (int *i) { return ((abs)(++*i)); }
#undef abs
int h (int *i) { return (abs (++*i)); }
</PRE>
<P>
Since macro definitions that double for a function behave in
exactly the same way as the actual function version, there is usually no
need for any of these methods. In fact, removing macro definitions usually
just makes your program slower.
<P>
<A NAME="IDX24"></A>
<A NAME="IDX25"></A>
<H3><A NAME="SEC11" HREF="library_toc.html#SEC11" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC11">Reserved Names</A></H3>
<P>
The names of all library types, macros, variables and functions that
come from the ANSI C standard are reserved unconditionally; your program
<STRONG>may not</STRONG> redefine these names. All other library names are
reserved if your programs explicitly includes the header file that
defines or declares them. There are several reasons for these
restrictions:
<P>
<UL>
<LI>
Other people reading your code could get very confused if you were using
a function named <CODE>exit</CODE> to do something completely different from
what the standard <CODE>exit</CODE> function does, for example. Preventing
this situation helps to make your programs easier to understand and
contributes to modularity and maintainability.
<P>
<LI>
It avoids the possibility of a user accidentally redefining a library
function that is called by other library functions. If redefinition
were allowed, those other functions would not work properly.
<P>
<LI>
It allows the compiler to do whatever special optimizations it pleases
on calls to these functions, without the possibility that they may have
been redefined by the user. Some library facilities, such as those for
dealing with variadic arguments (see section <A HREF="library_28.html#SEC472" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_28.html#SEC472">Variadic Functions</A>)
and non-local exits (see section <A HREF="library_20.html#SEC326" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_20.html#SEC326">Non-Local Exits</A>), actually require a
considerable amount of cooperation on the part of the C compiler, and
implementationally it might be easier for the compiler to treat these as
built-in parts of the language.
</UL>
<P>
In addition to the names documented in this manual, reserved names
include all external identifiers (global functions and variables) that
begin with an underscore (<SAMP>`_'</SAMP>) and all identifiers regardless of
use that begin with either two underscores or an underscore followed by
a capital letter are reserved names. This is so that the library and
header files can define functions, variables, and macros for internal
purposes without risk of conflict with names in user programs.
<P>
Some additional classes of identifier names are reserved for future
extensions to the C language. While using these names for your own
purposes right now might not cause a problem, they do raise the
possibility of conflict with future versions of the C standard, so you
should avoid these names.
<P>
<UL>
<LI>
Names beginning with a capital <SAMP>`E'</SAMP> followed a digit or uppercase
letter may be used for additional error code names. See section <A HREF="library_2.html#SEC14" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_2.html#SEC14">Error Reporting</A>.
<P>
<LI>
Names that begin with either <SAMP>`is'</SAMP> or <SAMP>`to'</SAMP> followed by a
lowercase letter may be used for additional character testing and
conversion functions. See section <A HREF="library_4.html#SEC54" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_4.html#SEC54">Character Handling</A>.
<P>
<LI>
Names that begin with <SAMP>`LC_'</SAMP> followed by an uppercase letter may be
used for additional macros specifying locale attributes.
See section <A HREF="library_7.html#SEC76" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_7.html#SEC76">Locales and Internationalization</A>.
<P>
<LI>
Names of all existing mathematics functions (see section <A HREF="library_17.html#SEC290" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_17.html#SEC290">Mathematics</A>)
suffixed with <SAMP>`f'</SAMP> or <SAMP>`l'</SAMP> are reserved for corresponding
functions that operate on <CODE>float</CODE> or <CODE>long double</CODE> arguments,
respectively.
<P>
<LI>
Names that begin with <SAMP>`SIG'</SAMP> followed by an uppercase letter are
reserved for additional signal names. See section <A HREF="library_21.html#SEC335" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC335">Standard Signals</A>.
<P>
<LI>
Names that begin with <SAMP>`SIG_'</SAMP> followed by an uppercase letter are
reserved for additional signal actions. See section <A HREF="library_21.html#SEC345" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC345">Basic Signal Handling</A>.
<P>
<LI>
Names beginning with <SAMP>`str'</SAMP>, <SAMP>`mem'</SAMP>, or <SAMP>`wcs'</SAMP> followed by a
lowercase letter are reserved for additional string and array functions.
See section <A HREF="library_5.html#SEC57" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_5.html#SEC57">String and Array Utilities</A>.
<P>
<LI>
Names that end with <SAMP>`_t'</SAMP> are reserved for additional type names.
</UL>
<P>
In addition, some individual header files reserve names beyond
those that they actually define. You only need to worry about these
restrictions if your program includes that particular header file.
<P>
<UL>
<LI>
The header file <TT>`dirent.h'</TT> reserves names prefixed with
<SAMP>`d_'</SAMP>.
<A NAME="IDX26"></A>
<P>
<LI>
The header file <TT>`fcntl.h'</TT> reserves names prefixed with
<SAMP>`l_'</SAMP>, <SAMP>`F_'</SAMP>, <SAMP>`O_'</SAMP>, and <SAMP>`S_'</SAMP>.
<A NAME="IDX27"></A>
<P>
<LI>
The header file <TT>`grp.h'</TT> reserves names prefixed with <SAMP>`gr_'</SAMP>.
<A NAME="IDX28"></A>
<P>
<LI>
The header file <TT>`limits.h'</TT> reserves names suffixed with <SAMP>`_MAX'</SAMP>.
<A NAME="IDX29"></A>
<P>
<LI>
The header file <TT>`pwd.h'</TT> reserves names prefixed with <SAMP>`pw_'</SAMP>.
<A NAME="IDX30"></A>
<P>
<LI>
The header file <TT>`signal.h'</TT> reserves names prefixed with <SAMP>`sa_'</SAMP>
and <SAMP>`SA_'</SAMP>.
<A NAME="IDX31"></A>
<P>
<LI>
The header file <TT>`sys/stat.h'</TT> reserves names prefixed with <SAMP>`st_'</SAMP>
and <SAMP>`S_'</SAMP>.
<A NAME="IDX32"></A>
<P>
<LI>
The header file <TT>`sys/times.h'</TT> reserves names prefixed with <SAMP>`tms_'</SAMP>.
<A NAME="IDX33"></A>
<P>
<LI>
The header file <TT>`termios.h'</TT> reserves names prefixed with <SAMP>`c_'</SAMP>,
<SAMP>`V'</SAMP>, <SAMP>`I'</SAMP>, <SAMP>`O'</SAMP>, and <SAMP>`TC'</SAMP>; and names prefixed with
<SAMP>`B'</SAMP> followed by a digit.
<A NAME="IDX34"></A>
</UL>
<P>
<H3><A NAME="SEC12" HREF="library_toc.html#SEC12" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC12">Feature Test Macros</A></H3>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -