stdlib.h
来自「此工具是arm-linux-GCC交叉编译工具(cross-3.4.4)」· C头文件 代码 · 共 964 行 · 第 1/3 页
H
964 行
/* Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *//* * ISO C99 Standard: 7.20 General utilities <stdlib.h> */#ifndef _STDLIB_H#include <features.h>/* Get size_t, wchar_t and NULL from <stddef.h>. */#define __need_size_t#ifndef __need_malloc_and_calloc# define __need_wchar_t# define __need_NULL#endif#include <stddef.h>__BEGIN_DECLS#ifndef __need_malloc_and_calloc#define _STDLIB_H 1#if defined __USE_XOPEN && !defined _SYS_WAIT_H/* XPG requires a few symbols from <sys/wait.h> being defined. */# include <bits/waitflags.h># include <bits/waitstatus.h># ifdef __USE_BSD/* Lots of hair to allow traditional BSD use of `union wait' as well as POSIX.1 use of `int' for the status word. */# if defined __GNUC__ && !defined __cplusplus# define __WAIT_INT(status) \ (__extension__ ({ union { __typeof(status) __in; int __i; } __u; \ __u.__in = (status); __u.__i; }))# else# define __WAIT_INT(status) (*(int *) &(status))# endif/* This is the type of the argument to `wait'. The funky union causes redeclarations with ether `int *' or `union wait *' to be allowed without complaint. __WAIT_STATUS_DEFN is the type used in the actual function definitions. */# if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus# define __WAIT_STATUS void *# define __WAIT_STATUS_DEFN void *# else/* This works in GCC 2.6.1 and later. */typedef union { union wait *__uptr; int *__iptr; } __WAIT_STATUS __attribute__ ((__transparent_union__));# define __WAIT_STATUS_DEFN int *# endif# else /* Don't use BSD. */# define __WAIT_INT(status) (status)# define __WAIT_STATUS int *# define __WAIT_STATUS_DEFN int *# endif /* Use BSD. *//* Define the macros <sys/wait.h> also would define this way. */# define WEXITSTATUS(status) __WEXITSTATUS(__WAIT_INT(status))# define WTERMSIG(status) __WTERMSIG(__WAIT_INT(status))# define WSTOPSIG(status) __WSTOPSIG(__WAIT_INT(status))# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status))# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status))# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))# ifdef __WIFCONTINUED# define WIFCONTINUED(status) __WIFCONTINUED(__WAIT_INT(status))# endif#endif /* X/Open and <sys/wait.h> not included. */__BEGIN_NAMESPACE_STD/* Returned by `div'. */typedef struct { int quot; /* Quotient. */ int rem; /* Remainder. */ } div_t;/* Returned by `ldiv'. */#ifndef __ldiv_t_definedtypedef struct { long int quot; /* Quotient. */ long int rem; /* Remainder. */ } ldiv_t;# define __ldiv_t_defined 1#endif__END_NAMESPACE_STD#if defined __USE_ISOC99 && !defined __lldiv_t_defined__BEGIN_NAMESPACE_C99/* Returned by `lldiv'. */__extension__ typedef struct { long long int quot; /* Quotient. */ long long int rem; /* Remainder. */ } lldiv_t;# define __lldiv_t_defined 1__END_NAMESPACE_C99#endif/* The largest number rand will return (same as INT_MAX). */#define RAND_MAX 2147483647/* We define these the same for all machines. Changes from this to the outside world should be done in `_exit'. */#define EXIT_FAILURE 1 /* Failing exit status. */#define EXIT_SUCCESS 0 /* Successful exit status. *//* Maximum length of a multibyte character in the current locale. */#define MB_CUR_MAX (__ctype_get_mb_cur_max ())extern size_t __ctype_get_mb_cur_max (void) __THROW;__BEGIN_NAMESPACE_STD/* Convert a string to a floating-point number. */extern double atof (__const char *__nptr) __THROW __attribute_pure__ __nonnull ((1));/* Convert a string to an integer. */extern int atoi (__const char *__nptr) __THROW __attribute_pure__ __nonnull ((1));/* Convert a string to a long integer. */extern long int atol (__const char *__nptr) __THROW __attribute_pure__ __nonnull ((1));__END_NAMESPACE_STD#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)__BEGIN_NAMESPACE_C99/* Convert a string to a long long integer. */__extension__ extern long long int atoll (__const char *__nptr) __THROW __attribute_pure__ __nonnull ((1));__END_NAMESPACE_C99#endif__BEGIN_NAMESPACE_STD/* Convert a string to a floating-point number. */extern double strtod (__const char *__restrict __nptr, char **__restrict __endptr) __THROW __nonnull ((1));__END_NAMESPACE_STD#ifdef __USE_ISOC99__BEGIN_NAMESPACE_C99/* Likewise for `float' and `long double' sizes of floating-point numbers. */extern float strtof (__const char *__restrict __nptr, char **__restrict __endptr) __THROW __nonnull ((1));extern long double strtold (__const char *__restrict __nptr, char **__restrict __endptr) __THROW __nonnull ((1));__END_NAMESPACE_C99#endif__BEGIN_NAMESPACE_STD/* Convert a string to a long integer. */extern long int strtol (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1));/* Convert a string to an unsigned long integer. */extern unsigned long int strtoul (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1));__END_NAMESPACE_C99#if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD/* Convert a string to a quadword integer. */__extension__extern long long int strtoq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1));/* Convert a string to an unsigned quadword integer. */__extension__extern unsigned long long int strtouq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1));#endif /* GCC and use BSD. */#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)__BEGIN_NAMESPACE_C99/* Convert a string to a quadword integer. */__extension__extern long long int strtoll (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1));/* Convert a string to an unsigned quadword integer. */__extension__extern unsigned long long int strtoull (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1));__END_NAMESPACE_C99#endif /* ISO C99 or GCC and use MISC. */#ifdef __USE_GNU/* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another application is the implementation of the internationalization handling in the upcoming ISO C++ standard library. To support this another set of the functions using locale data exist which have an additional argument. Attention: all these functions are *not* standardized in any form. This is a proof-of-concept implementation. *//* Structure for reentrant locale using functions. This is an (almost) opaque type for the user level programs. */# include <xlocale.h>/* Special versions of the functions above which take the locale to use as an additional parameter. */extern long int strtol_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4));extern unsigned long int strtoul_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4));__extension__extern long long int strtoll_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4));__extension__extern unsigned long long int strtoull_l (__const char *__restrict __nptr, char **__restrict __endptr, int __base, __locale_t __loc) __THROW __nonnull ((1, 4));extern double strtod_l (__const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) __THROW __nonnull ((1, 3));extern float strtof_l (__const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) __THROW __nonnull ((1, 3));extern long double strtold_l (__const char *__restrict __nptr, char **__restrict __endptr, __locale_t __loc) __THROW __nonnull ((1, 3));#endif /* GNU *//* The internal entry points for `strtoX' take an extra flag argument saying whether or not to parse locale-dependent number grouping. */extern double __strtod_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) __THROW __nonnull ((1));extern float __strtof_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) __THROW __nonnull ((1));extern long double __strtold_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __group) __THROW __nonnull ((1));#ifndef __strtol_internal_definedextern long int __strtol_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1));# define __strtol_internal_defined 1#endif#ifndef __strtoul_internal_definedextern unsigned long int __strtoul_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1));# define __strtoul_internal_defined 1#endif#if defined __GNUC__ || defined __USE_ISOC99# ifndef __strtoll_internal_defined__extension__extern long long int __strtoll_internal (__const char *__restrict __nptr, char **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1));# define __strtoll_internal_defined 1# endif# ifndef __strtoull_internal_defined__extension__extern unsigned long long int __strtoull_internal (__const char * __restrict __nptr, char **__restrict __endptr, int __base, int __group) __THROW __nonnull ((1));# define __strtoull_internal_defined 1# endif#endif /* GCC */#ifdef __USE_EXTERN_INLINES/* Define inline functions which call the internal entry points. */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?