[libcxx-commits] [libcxx] [libc++] Remove <stddef.h> includes from the granularized <cstddef> headers (PR #114788)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 5 06:24:57 PST 2024


================
@@ -10,15 +10,14 @@
 #define _LIBCPP___CSTDDEF_PTRDIFF_T_H
 
 #include <__config>
-#include <stddef.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-using ::ptrdiff_t _LIBCPP_USING_IF_EXISTS;
+using ptrdiff_t = __PTRDIFF_TYPE__;
----------------
ldionne wrote:

How about `using ptrdiff_t = decltype(static_cast<int*>(nullptr) - static_cast<int*>(nullptr));`? That decouples us a bit more from the compiler.

https://github.com/llvm/llvm-project/pull/114788


More information about the libcxx-commits mailing list