|
|
|
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 |
|
#if _MSC_VER > 1000 |
16 |
|
#pragma once |
17 |
|
#endif |
18 |
|
|
19 |
|
#ifndef _INC_STDDEF |
20 |
|
#define _INC_STDDEF |
21 |
|
|
22 |
|
#include <crtdefs.h> |
23 |
|
|
24 |
|
#ifdef __cplusplus |
25 |
|
extern "C" { |
26 |
|
#endif |
27 |
|
|
28 |
|
/* Define NULL pointer value */ |
29 |
|
#ifndef NULL |
30 |
|
#ifdef __cplusplus |
31 |
|
#define NULL 0 |
32 |
|
#else |
33 |
|
#define NULL ((void *)0) |
34 |
|
#endif |
35 |
|
#endif |
36 |
|
|
37 |
|
|
38 |
|
/* Declare reference to errno */ |
39 |
|
#ifndef _CRT_ERRNO_DEFINED |
40 |
|
#define _CRT_ERRNO_DEFINED |
41 |
|
_CRTIMP extern int * __cdecl _errno(void); |
42 |
|
#define errno (*_errno()) |
43 |
|
|
44 |
|
errno_t __cdecl _set_errno(_In_ int _Value); |
45 |
|
errno_t __cdecl _get_errno(_Out_ int * _Value); |
46 |
|
#endif |
47 |
|
|
48 |
|
/* Define offsetof macro */ |
49 |
|
#ifdef __cplusplus |
50 |
|
|
51 |
|
#ifdef _WIN64 |
52 |
|
#define offsetof(s,m) (size_t)( (ptrdiff_t)&reinterpret_cast<const volatile char&>((((s *)0)->m)) ) |