xref: /reactos/sdk/include/ucrt/stddef.h (revision e3e520d1)
1 //
2 // stddef.h
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // The C <stddef.h> Standard Library header.
7 //
8 #pragma once
9 #ifndef _INC_STDDEF // include guard for 3rd party interop
10 #define _INC_STDDEF
11 
12 #include <corecrt.h>
13 
14 #pragma warning(push)
15 #pragma warning(disable: _UCRT_DISABLED_WARNINGS)
16 _UCRT_DISABLE_CLANG_WARNINGS
17 
18 _CRT_BEGIN_C_HEADER
19 
20 
21 
22 #ifdef __cplusplus
23     namespace std
24     {
25         typedef decltype(__nullptr) nullptr_t;
26     }
27 
28     using ::std::nullptr_t;
29 #endif
30 
31 
32 
33 #if _CRT_FUNCTIONS_REQUIRED
34 
35     _ACRTIMP int* __cdecl _errno(void);
36     #define errno (*_errno())
37 
38     _ACRTIMP errno_t __cdecl _set_errno(_In_ int _Value);
39     _ACRTIMP errno_t __cdecl _get_errno(_Out_ int* _Value);
40 
41 #endif // _CRT_FUNCTIONS_REQUIRED
42 
43 
44 
45 #if defined _MSC_VER && !defined __clang__ && !defined _CRT_USE_BUILTIN_OFFSETOF
46     #ifdef __cplusplus
47         #define offsetof(s,m) ((::size_t)&reinterpret_cast<char const volatile&>((((s*)0)->m)))
48     #else
49         #define offsetof(s,m) ((size_t)&(((s*)0)->m))
50     #endif
51 #else
52     #define offsetof(s,m) __builtin_offsetof(s,m)
53 #endif
54 
55 _ACRTIMP extern unsigned long  __cdecl __threadid(void);
56 #define _threadid (__threadid())
57 _ACRTIMP extern uintptr_t __cdecl __threadhandle(void);
58 
59 
60 
61 _CRT_END_C_HEADER
62 _UCRT_RESTORE_CLANG_WARNINGS
63 #pragma warning(pop) // _UCRT_DISABLED_WARNINGS
64 #endif // _INC_STDDEF
65