cstdlib 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_CSTDLIB
  10. #define _LIBCPP_CSTDLIB
  11. /*
  12. cstdlib synopsis
  13. Macros:
  14. EXIT_FAILURE
  15. EXIT_SUCCESS
  16. MB_CUR_MAX
  17. NULL
  18. RAND_MAX
  19. namespace std
  20. {
  21. Types:
  22. size_t
  23. div_t
  24. ldiv_t
  25. lldiv_t // C99
  26. double atof (const char* nptr);
  27. int atoi (const char* nptr);
  28. long atol (const char* nptr);
  29. long long atoll(const char* nptr); // C99
  30. double strtod (const char* restrict nptr, char** restrict endptr);
  31. float strtof (const char* restrict nptr, char** restrict endptr); // C99
  32. long double strtold (const char* restrict nptr, char** restrict endptr); // C99
  33. long strtol (const char* restrict nptr, char** restrict endptr, int base);
  34. long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
  35. unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base);
  36. unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
  37. int rand(void);
  38. void srand(unsigned int seed);
  39. void* calloc(size_t nmemb, size_t size);
  40. void free(void* ptr);
  41. void* malloc(size_t size);
  42. void* realloc(void* ptr, size_t size);
  43. void abort(void);
  44. int atexit(void (*func)(void));
  45. void exit(int status);
  46. void _Exit(int status);
  47. char* getenv(const char* name);
  48. int system(const char* string);
  49. void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
  50. int (*compar)(const void *, const void *));
  51. void qsort(void* base, size_t nmemb, size_t size,
  52. int (*compar)(const void *, const void *));
  53. int abs( int j);
  54. long abs( long j);
  55. long long abs(long long j); // C++0X
  56. long labs( long j);
  57. long long llabs(long long j); // C99
  58. div_t div( int numer, int denom);
  59. ldiv_t div( long numer, long denom);
  60. lldiv_t div(long long numer, long long denom); // C++0X
  61. ldiv_t ldiv( long numer, long denom);
  62. lldiv_t lldiv(long long numer, long long denom); // C99
  63. int mblen(const char* s, size_t n);
  64. int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
  65. int wctomb(char* s, wchar_t wchar);
  66. size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
  67. size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
  68. int at_quick_exit(void (*func)(void)) // C++11
  69. void quick_exit(int status); // C++11
  70. void *aligned_alloc(size_t alignment, size_t size); // C11
  71. } // std
  72. */
  73. #include <__config>
  74. #include <stdlib.h>
  75. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  76. # pragma GCC system_header
  77. #endif
  78. _LIBCPP_BEGIN_NAMESPACE_STD
  79. using ::size_t _LIBCPP_USING_IF_EXISTS;
  80. using ::div_t _LIBCPP_USING_IF_EXISTS;
  81. using ::ldiv_t _LIBCPP_USING_IF_EXISTS;
  82. using ::lldiv_t _LIBCPP_USING_IF_EXISTS;
  83. using ::atof _LIBCPP_USING_IF_EXISTS;
  84. using ::atoi _LIBCPP_USING_IF_EXISTS;
  85. using ::atol _LIBCPP_USING_IF_EXISTS;
  86. using ::atoll _LIBCPP_USING_IF_EXISTS;
  87. using ::strtod _LIBCPP_USING_IF_EXISTS;
  88. using ::strtof _LIBCPP_USING_IF_EXISTS;
  89. using ::strtold _LIBCPP_USING_IF_EXISTS;
  90. using ::strtol _LIBCPP_USING_IF_EXISTS;
  91. using ::strtoll _LIBCPP_USING_IF_EXISTS;
  92. using ::strtoul _LIBCPP_USING_IF_EXISTS;
  93. using ::strtoull _LIBCPP_USING_IF_EXISTS;
  94. using ::rand _LIBCPP_USING_IF_EXISTS;
  95. using ::srand _LIBCPP_USING_IF_EXISTS;
  96. using ::calloc _LIBCPP_USING_IF_EXISTS;
  97. using ::free _LIBCPP_USING_IF_EXISTS;
  98. using ::malloc _LIBCPP_USING_IF_EXISTS;
  99. using ::realloc _LIBCPP_USING_IF_EXISTS;
  100. using ::abort _LIBCPP_USING_IF_EXISTS;
  101. using ::atexit _LIBCPP_USING_IF_EXISTS;
  102. using ::exit _LIBCPP_USING_IF_EXISTS;
  103. using ::_Exit _LIBCPP_USING_IF_EXISTS;
  104. #ifndef _LIBCPP_WINDOWS_STORE_APP
  105. using ::getenv _LIBCPP_USING_IF_EXISTS;
  106. using ::system _LIBCPP_USING_IF_EXISTS;
  107. #endif
  108. using ::bsearch _LIBCPP_USING_IF_EXISTS;
  109. using ::qsort _LIBCPP_USING_IF_EXISTS;
  110. using ::abs _LIBCPP_USING_IF_EXISTS;
  111. using ::labs _LIBCPP_USING_IF_EXISTS;
  112. using ::llabs _LIBCPP_USING_IF_EXISTS;
  113. using ::div _LIBCPP_USING_IF_EXISTS;
  114. using ::ldiv _LIBCPP_USING_IF_EXISTS;
  115. using ::lldiv _LIBCPP_USING_IF_EXISTS;
  116. using ::mblen _LIBCPP_USING_IF_EXISTS;
  117. using ::mbtowc _LIBCPP_USING_IF_EXISTS;
  118. using ::wctomb _LIBCPP_USING_IF_EXISTS;
  119. using ::mbstowcs _LIBCPP_USING_IF_EXISTS;
  120. using ::wcstombs _LIBCPP_USING_IF_EXISTS;
  121. #if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT)
  122. using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;
  123. using ::quick_exit _LIBCPP_USING_IF_EXISTS;
  124. #endif
  125. #if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_ALIGNED_ALLOC)
  126. using ::aligned_alloc _LIBCPP_USING_IF_EXISTS;
  127. #endif
  128. _LIBCPP_END_NAMESPACE_STD
  129. #endif // _LIBCPP_CSTDLIB