STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
stddef.h
Go to the documentation of this file.
1 /***
2 *stddef.h - definitions/declarations for common constants, types, variables
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * This file contains definitions and declarations for some commonly
8 * used constants, types, and variables.
9 * [ANSI]
10 *
11 * [Public]
12 *
13 ****/
14 
15 #pragma once
16 
17 #ifndef _INC_STDDEF
18 #define _INC_STDDEF
19 
20 #include <crtdefs.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25 
26 /* Define NULL pointer value */
27 #ifndef NULL
28 #ifdef __cplusplus
29 #define NULL 0
30 #else /* __cplusplus */
31 #define NULL ((void *)0)
32 #endif /* __cplusplus */
33 #endif /* NULL */
34 
35 #ifdef __cplusplus
36 namespace std { typedef decltype(__nullptr) nullptr_t; }
37 using ::std::nullptr_t;
38 #endif /* __cplusplus */
39 
40 /* Declare reference to errno */
41 #ifndef _CRT_ERRNO_DEFINED
42 #define _CRT_ERRNO_DEFINED
43 _CRTIMP extern int * __cdecl _errno(void);
44 #define errno (*_errno())
45 
46 errno_t __cdecl _set_errno(_In_ int _Value);
47 errno_t __cdecl _get_errno(_Out_ int * _Value);
48 #endif /* _CRT_ERRNO_DEFINED */
49 
50 /* Define offsetof macro */
51 #ifdef __cplusplus
52 
53 #ifdef _WIN64
54 #define offsetof(s,m) (size_t)( (ptrdiff_t)&reinterpret_cast<const volatile char&>((((s *)0)->m)) )
55 #else /* _WIN64 */
56 #define offsetof(s,m) (size_t)&reinterpret_cast<const volatile char&>((((s *)0)->m))
57 #endif /* _WIN64 */
58 
59 #else /* __cplusplus */
60 
61 #ifdef _WIN64
62 #define offsetof(s,m) (size_t)( (ptrdiff_t)&(((s *)0)->m) )
63 #else /* _WIN64 */
64 #define offsetof(s,m) (size_t)&(((s *)0)->m)
65 #endif /* _WIN64 */
66 
67 #endif /* __cplusplus */
68 
69 _CRTIMP extern unsigned long __cdecl __threadid(void);
70 #define _threadid (__threadid())
71 _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
72 
73 #ifdef __cplusplus
74 }
75 #endif /* __cplusplus */
76 
77 #endif /* _INC_STDDEF */
#define _Out_
Definition: sal.h:351
_CRTIMP int *__cdecl _errno(void)
_CRTIMP uintptr_t __cdecl __threadhandle(void)
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
#define _CRTIMP
Definition: crtdefs.h:23
STL namespace.
_W64 unsigned int uintptr_t
Definition: crtdefs.h:521
#define _In_
Definition: sal.h:314
errno_t __cdecl _set_errno(_In_ int _Value)
int errno_t
Definition: crtdefs.h:563
errno_t __cdecl _get_errno(_Out_ int *_Value)
_CRTIMP unsigned long __cdecl __threadid(void)